Bug 410890 - VerifyError around constructor
Summary: VerifyError around constructor
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: LTWeaving (show other bugs)
Version: 1.7.2   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-16 12:50 EDT by Christian Schulze CLA
Modified: 2013-06-30 04:48 EDT (History)
1 user (show)

See Also:


Attachments
Test Class (2.77 KB, application/x-java)
2013-06-16 12:50 EDT, Christian Schulze CLA
no flags Details
The source of PingPongServer class (1.42 KB, application/octet-stream)
2013-06-30 04:44 EDT, Christian Schulze CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Schulze CLA 2013-06-16 12:50:56 EDT
Created attachment 232418 [details]
Test Class

I'm using the WeavingURLClassLoader programatically for LTW. Once I add the following aspect the byte code verifier throws a java.lang.VerifyError: 

public pointcut serverSocketCtor() : 
  call(ServerSocket.new(..)) && 
  !within(com.gc.mimicry..*) && 
  !within(java..*);

Object around() : serverSocketCtor()
{
  return null;
}

java.lang.VerifyError: (class: examples/PingPongServer, method: main signature: ([Ljava/lang/String;)V) Unable to pop operand off an empty stack
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
	at java.lang.Class.getMethod0(Class.java:2694)
	at java.lang.Class.getMethod(Class.java:1622)
	...
Comment 1 Andrew Clement CLA 2013-06-26 17:29:57 EDT
Do you by any chance have the source code for examples.PingPongServer? (And how is it compiled to bytecode?)

It looks to be the unusual bytecode patterns in PingPongServer before the ServerSocket constructor is called. I think they are tripping up the around advice weaving.
Comment 2 Christian Schulze CLA 2013-06-30 04:44:35 EDT
Created attachment 232926 [details]
The source of PingPongServer class
Comment 3 Christian Schulze CLA 2013-06-30 04:48:58 EDT
Of course, I should have added it directly, sorry for that.
I've now attached the source code of the PingPongServer class.
It was compiled using Oracle's JDK and later on optimized using the soot framework (http://www.sable.mcgill.ca/soot/) with the following flags:

Options.v().set_keep_line_number( true );
Options.v().set_src_prec( Options.src_prec_only_class );
Options.v().set_output_format( Options.output_format_jasmin );
Options.v().set_keep_offset( true );

PhaseOptions.v().setPhaseOption( "jb", "on" );
PhaseOptions.v().setPhaseOption( "jb", "use-original-names:true" );