Issue1179

classification
Title: Expose should produce a class with the same bytecode version as the one it reads in
Type: Severity: normal
Components: Core Versions: Jython 2.5
Milestone:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: ethan-10gen, fwierzbicki, pjenvey, zyasoft
Priority: low Keywords:

Created on 2008-11-20.22:18:07 by ethan-10gen, last changed 2015-01-07.08:23:59 by zyasoft.

Files
File name Uploaded Description Edit Remove
Simple.java ethan-10gen, 2008-11-20.22:18:06
Messages
msg3797 (view) Author: Ethan Glasser-Camp (ethan-10gen) Date: 2008-11-20.22:18:06
I've been playing with the ExposeTask and ExposedTypeProcessor to expose
Java classes as Python types, and I got this exception:

java.lang.RuntimeException: JSR/RET are not supported with computeFrames
option
        at org.python.objectweb.asm.Frame.a(Unknown Source)
        at org.python.objectweb.asm.MethodWriter.visitJumpInsn(Unknown
Source)
        at org.python.objectweb.asm.MethodAdapter.visitJumpInsn(Unknown
Source)
        at org.python.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.python.objectweb.asm.ClassReader.accept(Unknown Source)
        at
org.python.expose.generate.ExposedTypeProcessor.<init>(ExposedTypeProcessor.java:52)
        at org.python.expose.generate.ExposeTask.execute(ExposeTask.java:84)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.Main.runBuild(Main.java:758)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

The kind people on #jython told me to file a bug and that what's
happening here is that the Expose code is seeing a "finally" clause and
the exposer generating 1.6 bytecode despite the fact that I'm running
1.5. I don't really understand the bug well enough to give a more
thorough explanation, but I'm attaching a class that caused this problem
(when using a 1.5 compiler).

Ethan
msg3912 (view) Author: Philip Jenvey (pjenvey) Date: 2008-12-11.00:30:35
As i understand it JSR/RET bytecodes are basically deprecated in Java 6 
(or is it 5?). I've never seen my 1.5 javac generate them, so before 
looking into this my question is:

What compiler originally compiled Simple.java before you tried to expose 
it? What's the compiler's version, and what is its -target set to?

Basically your javac shouldn't be generating JSR/RET (which it might be 
doing if it's targetting 1.4) if it's going to be used with our Exposer
msg3915 (view) Author: Ethan Glasser-Camp (ethan-10gen) Date: 2008-12-11.18:53:41
$ javac -version
javac 1.5.0_16
javac: no source files
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is
doing
  -deprecation               Output source locations where deprecated
APIs are used
  -classpath <path>          Specify where to find user class files
  -cp <path>                 Specify where to find user class files
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -d <directory>             Specify where to place generated class files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified
release
  -target <release>          Generate class files for specific VM version
  -version                   Version information
  -help                      Print a synopsis of standard options
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system

So the version appears to be 1.5.0_16. No -target is passed -- we run
javac using ant, with a javac step that doesn't have a target=
parameter. For some reason my version of file(1) doesn't tell me what
class file version it is, but as near as I can tell it's 49.0, i.e. J2SE
5.0.

$ hd build/ed/lang/python/SiteSystemState\$JSLibraryLoader.class | head
00000000  ca fe ba be 00 00 00 31  00 af 09 00 26 00 55 0a 
|.......1....&.U.|
msg9346 (view) Author: Jim Baker (zyasoft) Date: 2015-01-07.08:23:58
Expose uses ASM, so we are not going to be support this sort of feature requesst
History
Date User Action Args
2015-01-07 08:23:59zyasoftsetstatus: open -> closed
resolution: wont fix
messages: + msg9346
nosy: + zyasoft
2013-02-26 17:17:13fwierzbickisetnosy: + fwierzbicki
2013-02-25 19:01:22fwierzbickisetversions: + Jython 2.5, - 2.5.1
2009-03-14 13:57:52fwierzbickisetpriority: low
2009-03-14 02:44:07fwierzbickisetversions: + 2.5.1, - 2.5b0
2008-12-11 18:53:42ethan-10gensetmessages: + msg3915
2008-12-11 00:30:35pjenveysetnosy: + pjenvey
messages: + msg3912
2008-11-20 22:18:07ethan-10gencreate