Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 402237

Summary: [1.8][compiler] investigate differences between compilers re MethodVerifyTest
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: Manoj N Palat <manoj.palat>
Status: RESOLVED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, srikanth_sankaran
Version: 3.8   
Target Milestone: BETA J8   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=404648
Whiteboard:
Bug Depends on:    
Bug Blocks: 380190    

Description Stephan Herrmann CLA 2013-03-03 08:31:45 EST
Running MethodVerifyTest with -Dcompliance=1.8 -Drun.javac=enabled -Djdk.root=<location of jdk1.8.0/ea-lambda-b74> reports 20 deviations, which should be investigated:

Unused excuse:
- test043()

Eclipse found error(s) but Javac did not find any:
- test170()
- test171()
- test172()
- test173()
- test330435()

Eclipse found error(s) but Javac only found warning(s):
- test094()

Eclipse found warnings(s) but Javac did not find any:
- test169()
- test169a()
- test175()
- test186()
- test188()
- test346029c()
- test346029d()
- test346029e()

Javac found error(s) but Eclipse did not find any:
- test145()
- test204()
- test330445()
- test331446()

Probably irrelevant differences:
- test127()
Comment 1 Stephan Herrmann CLA 2013-03-03 08:56:47 EST
(In reply to comment #0)
> Eclipse found error(s) but Javac did not find any:
> - test170()
> - test171()
> - test172()
> - test173()

ECJ complains: overriding a synchronized method without being synchronized.

> - test173()

ECJ complains about missing impl. of hashCode()

Fix is by adding to the tests: Excuse.EclipseWarningConfiguredAsError

Will be released as part of the fix for bug 401796.

Remains in this category:
- - test330435(), error is:
  "Type mismatch: cannot convert from Object[] to String[]"
Comment 2 Stephan Herrmann CLA 2013-03-03 09:03:03 EST
(In reply to comment #0)
> Eclipse found error(s) but Javac only found warning(s):
> - test094()

Here ECJ reports
"The method addAll(Collection<? extends Y<X>>) in the type ArrayList<Y<X>> is not applicable for the arguments (List<Y>)"

This was reported by javac 1.7 but is not longer reported by java 1.8 b74.

Change in method resolution involving a raw type in type parameter position, do we have a bug for this?
Comment 3 Stephan Herrmann CLA 2013-03-03 09:08:02 EST
(In reply to comment #0)
> Javac found error(s) but Eclipse did not find any:
> - test145()

javac reports name clash between
  setValue(Object) in Base
  setValue(Tvalue) in BaseInterface

> - test204()

similar to test145() (?)

> - test330445()

javac reports:
method foo in class Y cannot be applied to given types;
        Y.foo(new Properties());
         ^
  required: Map<String,String>
  found: Properties
  reason: argument mismatch; Properties cannot be converted to Map<String,String>
  
> - test331446()

javac reports: "reference to assertEquals is ambiguous"

These will require a deeper look.
Comment 4 Stephan Herrmann CLA 2013-03-03 09:30:38 EST
(In reply to comment #0)
> Eclipse found warnings(s) but Javac did not find any:
> - test169()
> - test169a()

ECJ reports raw types

> - test175()

This was the one with missing hashCode() (typo in comment 1)

> - test186()

Not overriding a method that is private to a different package

> - test188()

raw type

> - test346029c()
> - test346029d()
> - test346029e()

missing @Override

Nothing dangerous, should be fixable by setting the appropriate Excuse.
Comment 5 Stephan Herrmann CLA 2013-03-03 10:06:48 EST
With the above changes (regarding appropriate excuses) I'm down to 8 deviations:

(In reply to comment #0)
> Unused excuse:
> - test043()
>
> Eclipse found error(s) but Javac did not find any:
> - test330435()
> 
> Eclipse found error(s) but Javac only found warning(s):
> - test094()
> 
> Javac found error(s) but Eclipse did not find any:
> - test145()
> - test204()
> - test330445()
> - test331446()
> 
> Probably irrelevant differences:
> - test127()

Main theme is: changed resolution in the presence of raw types.
Comment 2 and comment 3 capture the observations for the main issues.

----------------------------
Running the same comparison with javac 1.7.0_10 reports these deviations:
Like above:
   Unused excuse:
   - test043()
   Eclipse found error(s) but Javac did not find any:
  - test330435()
   Javac found error(s) but Eclipse did not find any:
   - test145()
   - test204()
   - test330445()
   - test331446()
   Probably irrelevant differences:
   - test127()
   
DIfferent issues:
   Eclipse found error(s) but Javac only found warning(s):
   - test144()
     name clash

=======================
Meta-diff (between 1.7 diffs and 1.8 diffs);

Only at 1.7
 - test144()
Only at 1.8
 - test094()
Comment 6 Stephan Herrmann CLA 2013-03-03 10:25:55 EST
Implementation note: in order to use the proper Excuses I had to modify the central function
 AbstractRegressionTest.runNegativeTest(boolean, String[], String[], Map, String, JavacTestOptions)
because it was not possible to 
 - run a negative test
 - with only a warning, no errors, and
 - use an Excuse
I copied a tiny piece of logic from a similar method:
 AbstractRegressionTest.runNegativeTest(String[], String)

I'm running the entire suite to check if this breaks anything.
Comment 7 Stephan Herrmann CLA 2013-03-03 11:43:12 EST
Test ran fine.

First bulk of changes has been released via commit ddff16f6a6b8fee88d497b4653d14d58ccda81b4 on behalf of bug 401796.

No longer blocking the work on default methods.
Comment 8 Stephan Herrmann CLA 2013-03-26 11:54:28 EDT
(In reply to comment #5)
> With the above changes (regarding appropriate excuses) I'm down to 8
> deviations:
> 
> (In reply to comment #0)
> > Unused excuse:
> > - test043()
> >
> > Eclipse found error(s) but Javac did not find any:
> > - test330435()
> > 
> > Eclipse found error(s) but Javac only found warning(s):
> > - test094()
> > 
> > Javac found error(s) but Eclipse did not find any:
> > - test145()
> > - test204()
> > - test330445()
> > - test331446()
> > 
> > Probably irrelevant differences:
> > - test127()
> 
> Main theme is: changed resolution in the presence of raw types.
> Comment 2 and comment 3 capture the observations for the main issues.


With lambda b81 the same 8 deviations can still be observed.
Comment 9 Srikanth Sankaran CLA 2014-02-06 19:51:15 EST
Let us carry forward this work in bug 404648

*** This bug has been marked as a duplicate of bug 404648 ***