| Summary: | Eclipse compiler accepts invalid syntax without error | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Alessandro Nistico <alienisty> |
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth.sankaran> |
| Status: | CLOSED MOVED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | manoj.palat, srikanth.sankaran, stephan.herrmann |
| Version: | 4.6 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
The bug happens all the way back to our first version supporting Java 8. 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. |
The following Java code is accepted without errors by eclipse: public class EclipseParserBug { private static void copy(boolean[] src, boolean[] dst) { long start=System.nanoTime(); IntStream.range(0, src.length).parallel().forEach(i -> dst[i] = src[i]))); System.out.println("Copy took: " + (System.nanoTime() - start)); } } which is compiled in the following byte code: // Compiled from EclipseParserBug.java (version 1.8 : 52.0, super bit) public class EclipseParserBug { // Method descriptor #6 ()V // Stack: 1, Locals: 1 public EclipseParserBug(); 0 aload_0 [this] 1 invokespecial java.lang.Object() [8] 4 return Line numbers: [pc: 0, line: 1] Local variable table: [pc: 0, pc: 5] local: this index: 0 type: EclipseParserBug // Method descriptor #15 ([Z[Z)V // Stack: 2, Locals: 4 private static void copy(boolean[] src, boolean[] dst); 0 invokestatic java.lang.System.nanoTime() : long [16] 3 lstore_2 [start] 4 return Line numbers: [pc: 0, line: 3] [pc: 4, line: 8] Local variable table: [pc: 0, pc: 5] local: src index: 0 type: boolean[] [pc: 0, pc: 5] local: dst index: 1 type: boolean[] [pc: 4, pc: 5] local: start index: 2 type: long } which is also incorrect. Note how only the first line of the source code has been compiled, despite having debug information for the rest. It seems like a very corner case but it could lead to very sneaky and hard to find bugs.