Unsed local variables Java 8 - java.lang.VerifyError: Inconsistent stackmap frames -


i have upgraded project java 1.8 1.7.

i exception inconsistent stackmap method in 1 of classes.

initializing unassigned local variables in method resolved it, can please explain why use of unread variables raise exception in java 8, thanks.

it might eclipse version (kepler sr 2 20140224-0627) using, curious.

workaround

  1. was using '--xxsplitverifier' (in 1.7) or '-noverify' jvm arguments before fixing faulty code.

  2. if compiler preferences in eclipse workspace unchecked option 'preserve unused local variables' compiles fine java 8

method :

cannot post complete method big , restrained code of company i'm with.

public synchronized int setdata()  //sample code  {     int id= 0;     stringbuffer sb;  // works if initialized - stringbuffer sb = null;     string  name;     // works if name = null      if (true) {         sb = new stringbuffer();         } else {         sb = new stringbuffer();       }   

stackframe :

caused by: java.lang.verifyerror: inconsistent stackmap frames @ branch target 2079

exception details: location: someclass.setdata(someclass/data)i @2079: iload_3

reason: type top (current frame, locals[4]) is not assignable 'java/lang/stringbuffer' (stack map, locals[4])

current frame: bci: @98 flags: { } locals: { 'someclass/setdata', 'someclass/data', 'someclass/data', integer, top, top } stack: { 'someclass/data' }

stackmap frame: bci: @2079 flags: { } locals: { 'someclass/setdata', 'someclass/data', 'someclass/data', integer, 'java/lang/stringbuffer', 'java/lang/string'} stack: { } bytecode: 0x0000000: 2bb6 032b 4d03 3e06 bd01 3e59 0313 032f 0x0000010: 5359 0413 0331 5359 0513 0333 533a 0606


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -