Bug 342936 - NPEs and inconsistencies when running jdt.compiler.tool.tests against Java 7
Summary: NPEs and inconsistencies when running jdt.compiler.tool.tests against Java 7
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 342688 343283
  Show dependency tree
 
Reported: 2011-04-15 05:02 EDT by Dani Megert CLA
Modified: 2011-04-25 13:23 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (44.76 KB, patch)
2011-04-15 13:48 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2011-04-15 05:02:31 EDT

    
Comment 1 Dani Megert CLA 2011-04-15 05:06:26 EDT
Problem is that
    ToolProvider.getSystemJavaCompiler();
returns 'null'.

According to Kim, the SDK is installed and tools.jar in place.
Comment 2 Dani Megert CLA 2011-04-15 05:30:44 EDT
I just tried on our Suse Linux machine using jdk-7-ea-bin-b137-linux-i586 and the tests pass.
Comment 3 Olivier Thomann CLA 2011-04-15 10:23:38 EDT
When I try to run a small program using this machine that prints out the java system compiler, and it works perfectly fine.
The best I can do for now is to skip the test when the system java compiler is null. This can potentially happen so we might want to add protection against this anyway.
Comment 4 Dani Megert CLA 2011-04-15 10:26:35 EDT
Kim, can you spin another build once that's done? We've fixed most of the issues.
Comment 5 Kim Moir CLA 2011-04-15 10:45:25 EDT
Sure, I'm running a test build for another bug.  I'll rerun those tests with Java 7 once the zips are available.
Comment 6 Olivier Thomann CLA 2011-04-15 13:37:02 EDT
Annotation processors don't behave exactly the same way between javac 1.7 and javac 1.6.
I'll try to come up with a reasonable support for both.
Comment 7 Olivier Thomann CLA 2011-04-15 13:48:19 EDT
Created attachment 193394 [details]
Proposed fix
Comment 8 Olivier Thomann CLA 2011-04-15 13:48:32 EDT
Released for 3.7M7.
Comment 9 Dani Megert CLA 2011-04-18 02:37:35 EDT
(In reply to comment #6)
> Annotation processors don't behave exactly the same way between javac 1.7 and
> javac 1.6.
> I'll try to come up with a reasonable support for both.

What's the difference? Anything that needs more attention?

Any clue why the tests get 'null' for getSystemJavaCompiler()? Aren't the tests run with Ant? Maybe some problem there?
Comment 10 Dani Megert CLA 2011-04-18 02:37:46 EDT
(In reply to comment #5)
> Sure, I'm running a test build for another bug.  I'll rerun those tests with
> Java 7 once the zips are available.

Kim, I haven't seen the build. BTW: please, make sure that code coverage is disabled.
Comment 11 Kim Moir CLA 2011-04-18 07:51:39 EDT
I had code coverage enabled in the previous build so I'll have to run them again. Are there specific test suites that you'd like me to run so instead of running all the tests again (4-5 hours)
Comment 12 Dani Megert CLA 2011-04-18 07:53:37 EDT
(In reply to comment #11)
> I had code coverage enabled in the previous build so I'll have to run them
> again. Are there specific test suites that you'd like me to run so instead of
> running all the tests again (4-5 hours)

I'd like to run all, so that I can look at one page and get the full picture.
Comment 13 Kim Moir CLA 2011-04-18 08:29:01 EDT
Okay, I'm rerunning the tests on Linux for N20110417-2000 which was a green build so any failures should be quite evident.  I'll regenerate the page once they have completed.
Comment 14 Olivier Thomann CLA 2011-04-18 09:02:27 EDT
(In reply to comment #9)
> (In reply to comment #6)
> > Annotation processors don't behave exactly the same way between javac 1.7 and
> > javac 1.6.
> > I'll try to come up with a reasonable support for both.
> 
Most differences are around the handling of error type. This is loosely spec'd and therefore it is difficult to know exactly what is supposed to be returned.
 
> What's the difference? Anything that needs more attention?
jsr269 doesn't really have specs. The specs are the javadoc of the corresponding types.

> Any clue why the tests get 'null' for getSystemJavaCompiler()? Aren't the tests
> run with Ant? Maybe some problem there?
No, but since this is possible I prefer to handle the cases inside the test suite. I believe that now the compiler.tool and compiler.apt tests are more resilient.
Comment 15 Jay Arthanareeswaran CLA 2011-04-25 13:23:20 EDT
Verified for 3.7M7 using code inspection.