Comments for page version of 2017-11-20
- Grammar: yes, avoiding any grammar changes sounds great.
- "Cannot use 'val' ...", should read 'var', right?
- DOM: we need to define a strategy for getType() methods of VariableDeclarationExpression and VariableDeclarationStatement, where we don't have a type reference (AST) to answer, but answering null is probably not an option, either. Some options:
- Synthesize a Type node with value "var" (and perhaps somehow tagged as a special node)
- Synthesize a Type with the (qualified?) name of the inferred type, but note the following problems:
- we cannot set source locations that match the length of the type reference.
- AST rewriting will get confused by a node that doesn't exist in source
- Quick fix: is specifying the allocation type (implementation) better then declaring the variable type? I think the opposite is the case. Inversely, for documentation purposes, a quick fix to change 'var' to the inferred type could be useful, IMHO (support lazy typing, consolidate later). Of course all this is a matter of style.
Comments for page version of 2017-11-21
- Specifying the source/target/compliance levels on the compiler is going to be tricky for JDK10, since it uses the same major versions in the classfile.
I'm suggesting handling this using the majorVersion from JDK9 + a pseudo minorVersion of 0x8001 for JDK-10. That way we can still use integer comparison for checking versions in the compiler.
- "Cannot use 'val' ..." has been corrected.
- DOM: getType() on VariableDeclarationExpression and VariableDeclarationStatement: This would only be an issue when the type cannot be inferred, right? I guess we should do it the same way we do for lambda types which can't be inferred. although I'm not sure what we do there...
- Quick fix: I got the idea from working with a different IDE using C#, it had a "Use 'var' instead"-assistance. I actually like the 'var'-style (provided you use good variable names).
Perhaps we should have a code style setting (local variables: prefer 'var' / prefer typenames), and use that to control irritants and quick fixes.