Jump to: navigation, search

Difference between revisions of "JDT UI/Java8"

(Test matrix)
Line 3: Line 3:
 
= Test matrix =
 
= Test matrix =
  
TBD
+
 
 +
<br>
 +
 
 +
{| cellspacing="0" cellpadding="5" border="1" align="center"
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Lambda Expressions
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Method references
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Default Methods
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Type Annotations / Receiver parameter
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Typing, reconciler
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Syntax coloring
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Semantic highlighting
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Mark occurrences
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Outline
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Content assist
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Type hierarchy
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Quick assists
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Quick fixes
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Clean ups
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Refactoring operations (core)
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Refactoring UIs
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Formatter
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Search
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Javadoc (hover, view)
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Source actions
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|-
 +
! width="200" align="center" style="background: none repeat scroll 0% 0%" | Call hierarchy
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
! width="200" align="center" style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" |
 +
|}
 +
<br>
 +
 
 +
{| cellspacing="0" cellpadding="5" border="1" style="width: 300px; height: 25px;"
 +
|-
 +
! style="background: none repeat scroll 0% 0% rgb(206, 242, 206);" | &nbsp;&nbsp;
 +
| Done
 +
|-
 +
! style="background: none repeat scroll 0% 0% rgb(206, 206, 242);" | <br>
 +
| Tested and works but can be improved (e.g. by adding Quick Assists or Quick Fixes)
 +
|-
 +
! style="background: none repeat scroll 0% 0% rgb(242, 206, 206);" | <br>
 +
| Not done yet
 +
|}
 +
(1) more work needed if spec changes
  
 
= Work areas =
 
= Work areas =

Revision as of 12:38, 20 March 2013

This page tracks the work in progress to add Java™ 8 support (mainly jsr308 "Type Annotations" and jsr335 "Lambda Expressions") into Eclipse JDT UI. See JDT Core/Java8 for the work in the JDT Core plug-ins.

Test matrix


Lambda Expressions Method references Default Methods Type Annotations / Receiver parameter
Typing, reconciler
Syntax coloring
Semantic highlighting
Mark occurrences
Outline
Content assist
Type hierarchy
Quick assists
Quick fixes
Clean ups
Refactoring operations (core)
Refactoring UIs
Formatter
Search
Javadoc (hover, view)
Source actions
Call hierarchy


   Done

Tested and works but can be improved (e.g. by adding Quick Assists or Quick Fixes)

Not done yet

(1) more work needed if spec changes

Work areas

  • set ASTProvider.SHARED_AST_LEVEL to JLS8
    • fix problems that need immediate handling
    • fix other references to JLS4
  • Annotations on types
    • Annotations that moved to another node in the AST (under discussion in bug 403834)
    • MethodDeclaration#thrownExceptions() -> thrownExceptionsTypes()
    • Annotations on Extra Dimensions
    • Receiver parameter on instance methods and inner class constructors
    • Render annotations in Javadoc hover/view. Do not render in Outline, etc. for now.
    • Refactoring dialogs that allow to modify types
  • Default Methods
  • Lambda Expressions
    • check code that walks the parent chain to find the enclosing Block or BodyDeclaration
  • Method References

IMPORTANT NOTE

  • The following lines must be added in all headers of modified files for Java™ 8 implementation:
 * This is an implementation of an early-draft specification developed under the Java
 * Community Process (JCP) and is made available for testing and evaluation purposes
 * only. The code is not compatible with any specification of the JCP.
 *

  • Use the following @since tag on all newly added members: "3.9 BETA_JAVA8"

Things to remember/caveats

  • Goal of the first pass is to make Eclipse work with the new language features. For more advanced support (new quick fixes / refactorings / templates / ...), please file an enhancement request with the [1.8] tag.
  • Bugs that went into the BETA_JAVA8 branch should be RESOLVED/FIXED with Target Milestone "BETA_JAVA8" and the [1.8] tag in front of the summary.
  • For ASTNode changes:
    • Search for references to a changed AST Node and update code that relies on the concrete structure
    • Remember there are multiple ways to access AST node properties:
      • via getter/setter or List-valued accessor
      • via the StructuralPropertyDescriptor constant
      • for properties declared in an abstract class: via get*Property() instance method
    • Check references to superclasses of the changed/added node type. E.g. for IntersectionType, code that thinks it handles all known subtypes of Type needs to be adjusted.
    • Add new node types to switch or if-else-if statements
    • Think about cases where code could use StructuralPropertyDescriptors
  • Think about cases where new bindings can show up.

DOM AST node changes in JLS8

If everything is correct, then you should find these as references to ASTNode#unsupportedIn2_3_4() and #supportedOnlyIn2_3_4().

+AnnotatableType (abstract superclass):
  +annotations: List<Annotation> (also in subtypes PrimitiveType, ArrayType, SimpleType, QualifiedType, WildcardType)

+ExtraDimensions
  +annotations: List<Annotation>

+LambdaExpression:
  +parentheses: boolean
  +parameters: List<SingleVariableDeclaration> or List<VariableDeclarationFragment>
  +body: Block or Expression
  +resolveMethodBinding(): IMethodBinding

~MethodDeclaration:
  +extraDimensions: List<ExtraDimension> (incl. annotations on extra dimensions)
  +receiverType: AnnotatableType
  +receiverQualifier: SimpleName
  -thrownExceptions: List<Name>
  +thrownExceptionTypes: List<Type>

~SingleVariableDeclaration:
  +varargsAnnotations: List<Annotation>

~TypeParameter:
  +annotations: List<Annotation>

~VariableDeclaration:
  +extraDimensions List<ExtraDimension> (also in subtypes SingleVariableDeclaration, VariableDeclarationFragment)

For JLS4, the changes were:

~TryStatement:
  +resources: List<VariableDeclarationExpression>

+UnionType
  +types: List<Type>

TODOs

  • 'default' flag:
    • show in the UI?
    • update JdtFlags?
  • The ITypeBinding of a TYPE_USE-annotated expression (e.g. ClassInstanceCreation or reference to a variable) doesn't contain the TYPE_USE annotations. References to "String s" and "@NonEmpty String ns" have identical type bindings. Should TYPE_USE annotations show up in reference bindings? Note that for some expressions, the annotated type is not defined by jsr 308, e.g. for the conditional expression here:
@Deprecated @NonEmpty String s = new Random().nextBoolean()
	? new @NonEmpty String("hi")
	: new String();