Bug 40712

Summary: Warn when compiling for 1.4 against a 1.3 library.
Product: [Eclipse Project] JDT Reporter: John Arthorne <john.arthorne>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r
Version: 3.0   
Target Milestone: 3.0 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Project compiler preferences none

Description John Arthorne CLA 2003-07-24 10:32:27 EDT
Build: I20030718 (M2)

Trying to evaluate any snippet in a scrapbook in my workspace results in an
UnsupportedClassVersionError.  This is using VM J9SC build 20030624 (without
-Xj9 vm arg).  I don't get any errors with a standard 1.3 VM.  Any ideas?  I can
open a defect against the VM vendor if you think that's where the problem is.  A
trivial snippet (such as "5+5") causes the failure.  Here is the stack:

java.lang.UnsupportedClassVersionError: CodeSnippet_10 (Unsupported major.minor
version 48.0)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:133)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:319)
	at java.net.URLClassLoader.access$400(URLClassLoader.java:92)
	at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:681)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:243)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:448)
	at java.lang.Class.forName1(Native Method)
	at java.lang.Class.forName(Class.java:145)
	at
org.eclipse.jdt.internal.debug.ui.snippeteditor.ScrapbookMain1.eval(ScrapbookMain1.java:21)
	at java.lang.reflect.Method.invoke(Native Method)
	at
org.eclipse.jdt.internal.debug.ui.snippeteditor.ScrapbookMain.evalLoop(ScrapbookMain.java:55)
	at
org.eclipse.jdt.internal.debug.ui.snippeteditor.ScrapbookMain.main(ScrapbookMain.java:33)
	at
org.eclipse.jdt.internal.debug.ui.snippeteditor.ScrapbookMain.evalLoop(ScrapbookMain.java:55)
	at
org.eclipse.jdt.internal.debug.ui.snippeteditor.ScrapbookMain.main(ScrapbookMain.java:33)
Comment 1 Darin Wright CLA 2003-07-24 10:45:58 EDT
I do not see this error (using the VM J9SC build 20030714a). However, could you 
look at your installed JRE definition to see if the problem may be related to 
bug 40673. Is it missing libraries?
Comment 2 Darin Wright CLA 2003-07-24 10:47:10 EDT
This is likely a different problem. What compilation preferences do you have 
for the project the snippet is compiled in? i.e. anything special?
Comment 3 John Arthorne CLA 2003-07-24 10:54:42 EDT
Created attachment 5548 [details]
Project compiler preferences
Comment 4 John Arthorne CLA 2003-07-24 10:57:08 EDT
I've figured it out.  That project had the compiler compliance level set to 1.4,
although I'm using a 1.3 VM.  So I was doing something wrong, but I think there
should have been a better warning somewhere (from the compiler?).
Comment 5 Darin Wright CLA 2003-07-24 11:07:19 EDT
There are two problems - when compiling against 1.3 with 1.4 compliance, there 
should be a compiler error (I will move this bug there). The runtime issue is 
ours - i.e. running 1.4 files against a 1.3 VM (already filed bug 38319).
Comment 6 Philipe Mulet CLA 2003-07-24 11:37:48 EDT
Did you enable the existing warning ?

Preferences > Java > Compiler > Build path > Incompatible Required Binaries 
Comment 7 Philipe Mulet CLA 2003-07-25 05:33:31 EDT
Closing, please reopen if suggested warning does not work.
Comment 8 John Arthorne CLA 2003-07-25 10:30:36 EDT
I'm wondering if "Incompatible required binaries" should be a warning by default
instead of ignore.  In my case I just got an obscure failure when running the
program, and it took some investigation and help from Darin to figure out what
was wrong.
Comment 9 Markus Keller CLA 2014-10-06 09:57:00 EDT
More discussions about this warning: bug 390446.