[Fb-contrib-commit] SF.net SVN: fb-contrib: [406] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2006-04-07 12:28:22
|
Revision: 406 Author: dbrosius Date: 2006-04-07 05:28:07 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=406&view=rev Log Message: ----------- allow to transition to the new getBytecodeSet by using reflection for now Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-07 02:01:50 UTC (rev 405) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-07 12:28:07 UTC (rev 406) @@ -1,5 +1,6 @@ package com.mebigfatguy.fbcontrib.detect; +import java.lang.reflect.Member; import java.util.BitSet; import java.util.HashMap; import java.util.Map; @@ -50,6 +51,17 @@ return super.clone(); } + private static java.lang.reflect.Method gbs; + private static BitSet transition_getBytecodeSet(ClassContext classContext, Method m) { + try { + if (gbs == null) + gbs = ClassContext.class.getMethod("getBytecodeSet", new Class[] { Method.class }); + return (BitSet)gbs.invoke(classContext, new Object[] { m }); + } catch (Exception e) { + return new BitSet(); + } + } + /** * looks for methods that contain a MONITORENTER opcode * @@ -57,7 +69,7 @@ * @return if the class uses synchronization */ public boolean prescreen(Method method) { - BitSet bytecodeSet = ClassContext.getBytecodeSet(method); + BitSet bytecodeSet = transition_getBytecodeSet(getClassContext(), method); return bytecodeSet != null && (bytecodeSet.get(Constants.MONITORENTER)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |