Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359801 - Classes are compiled even though incorrect (wrong JDK level)
Summary: Classes are compiled even though incorrect (wrong JDK level)
Status: CLOSED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 04:53 EDT by Anders Hammar CLA
Modified: 2021-04-19 13:25 EDT (History)
1 user (show)

See Also:


Attachments
Test project to reproduce (10.22 KB, application/octet-stream)
2011-10-04 04:54 EDT, Anders Hammar CLA
no flags Details
test project 2 (11.58 KB, application/octet-stream)
2011-10-04 06:27 EDT, Anders Hammar CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Hammar CLA 2011-10-04 04:53:58 EDT
Build Identifier: 20110615-0604

m2e 1.0.100

Happens on both Mac and Windows.

Reproducible: Always

Steps to Reproduce:
1. Unpack provided test project
2. Import lab-n1
3. Notice the error on the EvalScript.java class
4. The Maven project has target 1.4 specified but the class required Java 5. Executing Run as -> Maven install should not work, but it does. The reasons is that the class somehow has been compiled although it shouldn't be possible. So the compiler plugin doesn't need to compile and thus doesn't fail.
Comment 1 Anders Hammar CLA 2011-10-04 04:54:34 EDT
Created attachment 204496 [details]
Test project to reproduce
Comment 2 Anders Hammar CLA 2011-10-04 04:55:31 EDT
Workaround is to execute Run as -> Maven clean and the re-run Run as -> Maven install.
Comment 3 Anders Hammar CLA 2011-10-04 05:00:08 EDT
I'm guessing here, but could it be that the Java level is not honored during the project import and the class is therefore compiled correctly?
Comment 4 Anders Hammar CLA 2011-10-04 06:27:20 EDT
Created attachment 204500 [details]
test project 2

Added yet a test project that shows the same behavior. This project (lab-d1) uses some classes not added as dependencies to the pom. Still, the class is compiled by the jdt.
Comment 5 Igor Fedorenko CLA 2011-10-04 07:53:08 EDT
JDT creates .class files even for sources that have compilation errors. This is expected and desired behaviour inside IDE.
Comment 6 Anders Hammar CLA 2011-10-04 07:59:02 EDT
(In reply to comment #5)
> JDT creates .class files even for sources that have compilation errors. This is
> expected and desired behaviour inside IDE.

Ok, I see. But this confuses people when they execute "Run as -> Maven install" I think. Maybe there is no solution to that?
Comment 7 Denis Roy CLA 2021-04-19 13:25:49 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/