aboutsummaryrefslogtreecommitdiff
path: root/src/main/javassist/CtNewWrappedMethod.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/javassist/CtNewWrappedMethod.java')
-rw-r--r--src/main/javassist/CtNewWrappedMethod.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/main/javassist/CtNewWrappedMethod.java b/src/main/javassist/CtNewWrappedMethod.java
index 94cabd6..2e6a6a8 100644
--- a/src/main/javassist/CtNewWrappedMethod.java
+++ b/src/main/javassist/CtNewWrappedMethod.java
@@ -1,11 +1,12 @@
/*
* Javassist, a Java-bytecode translator toolkit.
- * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved.
+ * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. Alternatively, the contents of this file may be used under
- * the terms of the GNU Lesser General Public License Version 2.1 or later.
+ * the terms of the GNU Lesser General Public License Version 2.1 or later,
+ * or the Apache License Version 2.0.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
@@ -15,10 +16,16 @@
package javassist;
-import javassist.bytecode.*;
-import javassist.compiler.JvstCodeGen;
-import java.util.Hashtable;
+import java.util.Map;
+
import javassist.CtMethod.ConstParameter;
+import javassist.bytecode.AccessFlag;
+import javassist.bytecode.BadBytecode;
+import javassist.bytecode.Bytecode;
+import javassist.bytecode.ClassFile;
+import javassist.bytecode.MethodInfo;
+import javassist.bytecode.SyntheticAttribute;
+import javassist.compiler.JvstCodeGen;
class CtNewWrappedMethod {
@@ -43,7 +50,9 @@ class CtNewWrappedMethod {
Bytecode code = makeBody(declaring, declaring.getClassFile2(), body,
parameterTypes, returnType, constParam);
- mt.getMethodInfo2().setCodeAttribute(code.toCodeAttribute());
+ MethodInfo minfo = mt.getMethodInfo2();
+ minfo.setCodeAttribute(code.toCodeAttribute());
+ // a stack map has been already created.
return mt;
}
@@ -136,8 +145,8 @@ class CtNewWrappedMethod {
CtMethod src)
throws BadBytecode, CannotCompileException
{
- Hashtable bodies = clazz.getHiddenMethods();
- String bodyname = (String)bodies.get(src);
+ Map<CtMethod,String> bodies = clazz.getHiddenMethods();
+ String bodyname = bodies.get(src);
if (bodyname == null) {
do {
bodyname = addedWrappedMethod + clazz.getUniqueNumber();
@@ -150,7 +159,7 @@ class CtNewWrappedMethod {
int acc = body.getAccessFlags();
body.setAccessFlags(AccessFlag.setPrivate(acc));
body.addAttribute(new SyntheticAttribute(classfile.getConstPool()));
- // a stack map is copied. rebuilding it is not needed.
+ // a stack map is copied. rebuilding it is not needed.
classfile.addMethod(body);
bodies.put(src, bodyname);
CtMember.Cache cache = clazz.hasMemberCache();