From b2696762829078309af7b7b3b7e29fc599d01cda Mon Sep 17 00:00:00 2001 From: chiba Date: Sat, 5 May 2007 03:47:52 +0000 Subject: [PATCH] Javassist has been producing an interface with a wrong modifier. I fixed this. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@367 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/CtClass.java | 4 ++-- src/main/javassist/CtClassType.java | 3 +-- src/main/javassist/bytecode/ClassFile.java | 8 +++++--- src/main/javassist/bytecode/ClassFileWriter.java | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index e801a224..b35b3100 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -52,7 +52,7 @@ public abstract class CtClass { /** * The version number of this release. */ - public static final String version = "3.5GA"; + public static final String version = "3.6.0BETA"; /** * Prints the version number and the copyright notice. @@ -63,7 +63,7 @@ public abstract class CtClass { */ public static void main(String[] args) { System.out.println("Javassist version " + CtClass.version); - System.out.println("Copyright (C) 1999-2006 Shigeru Chiba." + System.out.println("Copyright (C) 1999-2007 Shigeru Chiba." + " All Rights Reserved."); } diff --git a/src/main/javassist/CtClassType.java b/src/main/javassist/CtClassType.java index 0ec764e4..d9146d0a 100644 --- a/src/main/javassist/CtClassType.java +++ b/src/main/javassist/CtClassType.java @@ -414,8 +414,7 @@ class CtClassType extends CtClass { } checkModify(); - int acc = AccessFlag.of(mod) | AccessFlag.SUPER; - cf.setAccessFlags(acc); + cf.setAccessFlags(AccessFlag.of(mod)); } public Object[] getAnnotations() throws ClassNotFoundException { diff --git a/src/main/javassist/bytecode/ClassFile.java b/src/main/javassist/bytecode/ClassFile.java index 82221d45..50b6cacd 100644 --- a/src/main/javassist/bytecode/ClassFile.java +++ b/src/main/javassist/bytecode/ClassFile.java @@ -68,8 +68,7 @@ public final class ClassFile { constPool = new ConstPool(classname); thisClass = constPool.getThisClassInfo(); if (isInterface) - accessFlags = AccessFlag.SUPER | AccessFlag.INTERFACE - | AccessFlag.ABSTRACT; + accessFlags = AccessFlag.INTERFACE | AccessFlag.ABSTRACT; else accessFlags = AccessFlag.SUPER; @@ -237,7 +236,10 @@ public final class ClassFile { * @see javassist.bytecode.AccessFlag */ public void setAccessFlags(int acc) { - accessFlags = acc | AccessFlag.SUPER; + if ((acc & AccessFlag.INTERFACE) == 0) + acc |= AccessFlag.SUPER; + + accessFlags = acc; } /** diff --git a/src/main/javassist/bytecode/ClassFileWriter.java b/src/main/javassist/bytecode/ClassFileWriter.java index 2d667a86..b4f83895 100644 --- a/src/main/javassist/bytecode/ClassFileWriter.java +++ b/src/main/javassist/bytecode/ClassFileWriter.java @@ -45,7 +45,8 @@ public class ClassFileWriter { int mod = AccessFlag.toModifier(cf.getAccessFlags() & ~AccessFlag.SYNCHRONIZED); - out.println("major: " + cf.major + ", minor: " + cf.minor); + out.println("major: " + cf.major + ", minor: " + cf.minor + + "modifiers: " + Integer.toHexString(cf.getAccessFlags())); out.println(Modifier.toString(mod) + " class " + cf.getName() + " extends " + cf.getSuperclass()); -- 2.39.5