[jboss-jira] [JBoss JIRA] (JASSIST-193) assignments without explicit cast cause VM errors

Pawel Veselov (JIRA) jira-events at lists.jboss.org
Thu Apr 4 03:10:43 EDT 2013


     [ https://issues.jboss.org/browse/JASSIST-193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pawel Veselov updated JASSIST-193:
----------------------------------

    Attachment: JA1.java
                JA2.java


Attached are two classes, to showcase the problem.

$ javac -classpath lib/javassist-3.17.1/javassist.jar JA*.java

$ java -cp .:lib/javassist-3.17.1/javassist.jar JA1
Exception in thread "main" java.lang.VerifyError: (class: JA2, method: none signature: ()V) Incompatible object argument for function call
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
	at java.lang.Class.getConstructor0(Class.java:2699)
	at java.lang.Class.newInstance0(Class.java:326)
	at java.lang.Class.newInstance(Class.java:308)
	at JA1.main(JA1.java:18)


Expectation is that either compilation should fail, or that a checkcast should be inserted, if left is not assignable from right.

                
> assignments without explicit cast cause VM errors
> -------------------------------------------------
>
>                 Key: JASSIST-193
>                 URL: https://issues.jboss.org/browse/JASSIST-193
>             Project: Javassist
>          Issue Type: Bug
>    Affects Versions: 3.17.1-GA
>         Environment: 1.6 jdk, but not limited to
>            Reporter: Pawel Veselov
>            Assignee: Shigeru Chiba
>         Attachments: JA1.java, JA2.java
>
>
> javassist will compile code when assignment is done without an explicit cast, e.g.:
> Object p;
> String s = p;
> However, assignment receptacle is not checked for type, causing VM errors when byte code is verified.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list