Community
Participate
Working Groups
JDT UI's org.eclipse.jdt.ui.tests.refactoring.ExtractConstantTests#test34() fails in BETA_JAVA8 because we get an unexpected second syntax error when trying to compile the result of the refactoring. Source: package p; import java.util.List; class A { private static final String STRING = new String(); { Object o= STRING; Object o2= STRING } } In master, we get the error: - Syntax error, insert ";" to complete LocalVariableDeclarationStatement In BETA_JAVA8, we get: - Syntax error, insert ":: IdentifierOrNew" to complete Expression - Syntax error, insert ";" to complete LocalVariableDeclarationStatement The first error should not be issued. It doesn't make sense at all in pre-JLS8 ASTs, and even in JLS8, inserting a method reference would not fix the problem.
(In reply to comment #0) > In BETA_JAVA8, we get: > - Syntax error, insert ":: IdentifierOrNew" to complete Expression > - Syntax error, insert ";" to complete LocalVariableDeclarationStatement > > The first error should not be issued. It doesn't make sense at all in > pre-JLS8 ASTs, and even in JLS8, inserting a method reference would not fix > the problem. The parser is attempting to repair the broken program from purely a grammatical pov. Object o2 = STTRING::Identifer or Object o2 = STTRING::new is a valid suggestion - if you ignore semantics and look only at syntax. It is too much to ask the DiagnoseParser to know more about the language. It is strange that this would show up in a 1.7 compliance settings also. The grammar file does tag the relevant rules as being 1.8 specific, this could be a bug in the parser generator.
If we don't get a fix we should disable the test for now in the BETA_JAVA8 branch.
(In reply to Srikanth Sankaran from comment #1) > The parser is attempting to repair the broken program from purely > a grammatical pov. > > Object o2 = STRING::Identifier or > Object o2 = STRING::new > > is a valid suggestion - if you ignore semantics and look only at syntax. > It is too much to ask the DiagnoseParser to know more about the language. Nope, these suggestions would not yield a syntactically valid statement. They are just as incomplete as the original 'Object o2= STRING', and they they won't ever reduce the syntax error count. By the same argument, the DiagnoseParser could also tell me to replace 'Object' with 'ParameterizedType<Arg>' -- equally useless. The 'insert ";"' error resolves the syntax problem, so this one is also better (and enough) from a purely syntactical point of view. Disabled failing JDT UI test with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=9ada4158cd9688430dee9ca16b78fe7d575af05a
(In reply to Markus Keller from comment #3) > (In reply to Srikanth Sankaran from comment #1) > > The parser is attempting to repair the broken program from purely > > a grammatical pov. > > > > Object o2 = STRING::Identifier or > > Object o2 = STRING::new > > > > is a valid suggestion - if you ignore semantics and look only at syntax. > > It is too much to ask the DiagnoseParser to know more about the language. > > Nope, these suggestions would not yield a syntactically valid statement. > They are just as incomplete as the original 'Object o2= STRING', and they > they won't ever reduce the syntax error count. > > By the same argument, the DiagnoseParser could also tell me to replace > 'Object' with 'ParameterizedType<Arg>' -- equally useless. The 'insert ";"' > error resolves the syntax problem, so this one is also better (and enough) > from a purely syntactical point of view. Mind you, there are two two recommendations and they together make a valid statement. It is not disputed that the old message is way better and enough.
Given my time off plans and what is already on my plate, I don't expect to get to this by 4.4
sasi: can you please take a look at this for 4.7?
Bulk move out of 4.8
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.