|
|
|
@ -274,8 +274,8 @@ public class ClassWriter { |
|
|
|
|
StructClass cl = wrapper.getClassStruct(); |
|
|
|
|
|
|
|
|
|
int flags = node.type == ClassNode.CLASS_ROOT ? cl.getAccessFlags() : node.access; |
|
|
|
|
boolean isDeprecated = cl.hasAttribute("Deprecated"); |
|
|
|
|
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || cl.hasAttribute("Synthetic"); |
|
|
|
|
boolean isDeprecated = cl.hasAttribute(StructGeneralAttribute.ATTRIBUTE_DEPRECATED); |
|
|
|
|
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || cl.hasAttribute(StructGeneralAttribute.ATTRIBUTE_SYNTHETIC); |
|
|
|
|
boolean isEnum = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM) && (flags & CodeConstants.ACC_ENUM) != 0; |
|
|
|
|
boolean isInterface = (flags & CodeConstants.ACC_INTERFACE) != 0; |
|
|
|
|
boolean isAnnotation = (flags & CodeConstants.ACC_ANNOTATION) != 0; |
|
|
|
@ -366,7 +366,7 @@ public class ClassWriter { |
|
|
|
|
private void fieldToJava(ClassWrapper wrapper, StructClass cl, StructField fd, TextBuffer buffer, int indent, BytecodeMappingTracer tracer) { |
|
|
|
|
int start = buffer.length(); |
|
|
|
|
boolean isInterface = cl.hasModifier(CodeConstants.ACC_INTERFACE); |
|
|
|
|
boolean isDeprecated = fd.hasAttribute("Deprecated"); |
|
|
|
|
boolean isDeprecated = fd.hasAttribute(StructGeneralAttribute.ATTRIBUTE_DEPRECATED); |
|
|
|
|
boolean isEnum = fd.hasModifier(CodeConstants.ACC_ENUM) && DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM); |
|
|
|
|
|
|
|
|
|
if (isDeprecated) { |
|
|
|
@ -394,7 +394,7 @@ public class ClassWriter { |
|
|
|
|
|
|
|
|
|
GenericFieldDescriptor descriptor = null; |
|
|
|
|
if (DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES)) { |
|
|
|
|
StructGenericSignatureAttribute attr = (StructGenericSignatureAttribute)fd.getAttribute("Signature"); |
|
|
|
|
StructGenericSignatureAttribute attr = fd.getAttribute(StructGeneralAttribute.ATTRIBUTE_SIGNATURE); |
|
|
|
|
if (attr != null) { |
|
|
|
|
descriptor = GenericMain.parseFieldSignature(attr.getSignature()); |
|
|
|
|
} |
|
|
|
@ -580,7 +580,7 @@ public class ClassWriter { |
|
|
|
|
boolean isInterface = cl.hasModifier(CodeConstants.ACC_INTERFACE); |
|
|
|
|
boolean isAnnotation = cl.hasModifier(CodeConstants.ACC_ANNOTATION); |
|
|
|
|
boolean isEnum = cl.hasModifier(CodeConstants.ACC_ENUM) && DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM); |
|
|
|
|
boolean isDeprecated = mt.hasAttribute("Deprecated"); |
|
|
|
|
boolean isDeprecated = mt.hasAttribute(StructGeneralAttribute.ATTRIBUTE_DEPRECATED); |
|
|
|
|
boolean clinit = false, init = false, dinit = false; |
|
|
|
|
|
|
|
|
|
MethodDescriptor md = MethodDescriptor.parseDescriptor(mt.getDescriptor()); |
|
|
|
@ -602,7 +602,7 @@ public class ClassWriter { |
|
|
|
|
appendRenameComment(buffer, oldName, MType.METHOD, indent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || mt.hasAttribute("Synthetic"); |
|
|
|
|
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || mt.hasAttribute(StructGeneralAttribute.ATTRIBUTE_SYNTHETIC); |
|
|
|
|
boolean isBridge = (flags & CodeConstants.ACC_BRIDGE) != 0; |
|
|
|
|
if (isSynthetic) { |
|
|
|
|
appendComment(buffer, "synthetic method", indent); |
|
|
|
@ -640,7 +640,7 @@ public class ClassWriter { |
|
|
|
|
|
|
|
|
|
GenericMethodDescriptor descriptor = null; |
|
|
|
|
if (DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES)) { |
|
|
|
|
StructGenericSignatureAttribute attr = (StructGenericSignatureAttribute)mt.getAttribute("Signature"); |
|
|
|
|
StructGenericSignatureAttribute attr = mt.getAttribute(StructGeneralAttribute.ATTRIBUTE_SIGNATURE); |
|
|
|
|
if (attr != null) { |
|
|
|
|
descriptor = GenericMain.parseMethodSignature(attr.getSignature()); |
|
|
|
|
if (descriptor != null) { |
|
|
|
@ -768,7 +768,7 @@ public class ClassWriter { |
|
|
|
|
|
|
|
|
|
buffer.append(')'); |
|
|
|
|
|
|
|
|
|
StructExceptionsAttribute attr = (StructExceptionsAttribute)mt.getAttribute("Exceptions"); |
|
|
|
|
StructExceptionsAttribute attr = mt.getAttribute(StructGeneralAttribute.ATTRIBUTE_EXCEPTIONS); |
|
|
|
|
if ((descriptor != null && !descriptor.exceptionTypes.isEmpty()) || attr != null) { |
|
|
|
|
throwsExceptions = true; |
|
|
|
|
buffer.append(" throws "); |
|
|
|
@ -793,7 +793,7 @@ public class ClassWriter { |
|
|
|
|
|
|
|
|
|
if ((flags & (CodeConstants.ACC_ABSTRACT | CodeConstants.ACC_NATIVE)) != 0) { // native or abstract method (explicit or interface)
|
|
|
|
|
if (isAnnotation) { |
|
|
|
|
StructAnnDefaultAttribute attr = (StructAnnDefaultAttribute)mt.getAttribute("AnnotationDefault"); |
|
|
|
|
StructAnnDefaultAttribute attr = mt.getAttribute(StructGeneralAttribute.ATTRIBUTE_ANNOTATION_DEFAULT); |
|
|
|
|
if (attr != null) { |
|
|
|
|
buffer.append(" default "); |
|
|
|
|
buffer.append(attr.getDefaultValue().toJava(0, BytecodeMappingTracer.DUMMY)); |
|
|
|
@ -946,18 +946,18 @@ public class ClassWriter { |
|
|
|
|
buffer.appendIndent(indent).append("// $FF: ").append(comment).appendLineSeparator(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static final String[] ANNOTATION_ATTRIBUTES = { |
|
|
|
|
private static final StructGeneralAttribute.Key[] ANNOTATION_ATTRIBUTES = { |
|
|
|
|
StructGeneralAttribute.ATTRIBUTE_RUNTIME_VISIBLE_ANNOTATIONS, StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS}; |
|
|
|
|
private static final String[] PARAMETER_ANNOTATION_ATTRIBUTES = { |
|
|
|
|
private static final StructGeneralAttribute.Key[] PARAMETER_ANNOTATION_ATTRIBUTES = { |
|
|
|
|
StructGeneralAttribute.ATTRIBUTE_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS, StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS}; |
|
|
|
|
private static final String[] TYPE_ANNOTATION_ATTRIBUTES = { |
|
|
|
|
private static final StructGeneralAttribute.Key[] TYPE_ANNOTATION_ATTRIBUTES = { |
|
|
|
|
StructGeneralAttribute.ATTRIBUTE_RUNTIME_VISIBLE_TYPE_ANNOTATIONS, StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS}; |
|
|
|
|
|
|
|
|
|
private static void appendAnnotations(TextBuffer buffer, int indent, StructMember mb, int targetType) { |
|
|
|
|
Set<String> filter = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
for (String name : ANNOTATION_ATTRIBUTES) { |
|
|
|
|
StructAnnotationAttribute attribute = (StructAnnotationAttribute)mb.getAttribute(name); |
|
|
|
|
for (StructGeneralAttribute.Key key : ANNOTATION_ATTRIBUTES) { |
|
|
|
|
StructAnnotationAttribute attribute = (StructAnnotationAttribute)mb.getAttribute(key); |
|
|
|
|
if (attribute != null) { |
|
|
|
|
for (AnnotationExprent annotation : attribute.getAnnotations()) { |
|
|
|
|
String text = annotation.toJava(indent, BytecodeMappingTracer.DUMMY).toString(); |
|
|
|
@ -973,8 +973,8 @@ public class ClassWriter { |
|
|
|
|
private static void appendParameterAnnotations(TextBuffer buffer, StructMethod mt, int param) { |
|
|
|
|
Set<String> filter = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
for (String name : PARAMETER_ANNOTATION_ATTRIBUTES) { |
|
|
|
|
StructAnnotationParameterAttribute attribute = (StructAnnotationParameterAttribute)mt.getAttribute(name); |
|
|
|
|
for (StructGeneralAttribute.Key key : PARAMETER_ANNOTATION_ATTRIBUTES) { |
|
|
|
|
StructAnnotationParameterAttribute attribute = (StructAnnotationParameterAttribute)mt.getAttribute(key); |
|
|
|
|
if (attribute != null) { |
|
|
|
|
List<List<AnnotationExprent>> annotations = attribute.getParamAnnotations(); |
|
|
|
|
if (param < annotations.size()) { |
|
|
|
@ -991,8 +991,8 @@ public class ClassWriter { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void appendTypeAnnotations(TextBuffer buffer, int indent, StructMember mb, int targetType, int index, Set<String> filter) { |
|
|
|
|
for (String name : TYPE_ANNOTATION_ATTRIBUTES) { |
|
|
|
|
StructTypeAnnotationAttribute attribute = (StructTypeAnnotationAttribute)mb.getAttribute(name); |
|
|
|
|
for (StructGeneralAttribute.Key key : TYPE_ANNOTATION_ATTRIBUTES) { |
|
|
|
|
StructTypeAnnotationAttribute attribute = (StructTypeAnnotationAttribute)mb.getAttribute(key); |
|
|
|
|
if (attribute != null) { |
|
|
|
|
for (TypeAnnotation annotation : attribute.getAnnotations()) { |
|
|
|
|
if (annotation.isTopLevel() && annotation.getTargetType() == targetType && (index < 0 || annotation.getIndex() == index)) { |
|
|
|
@ -1057,7 +1057,7 @@ public class ClassWriter { |
|
|
|
|
|
|
|
|
|
public static GenericClassDescriptor getGenericClassDescriptor(StructClass cl) { |
|
|
|
|
if (DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES)) { |
|
|
|
|
StructGenericSignatureAttribute attr = (StructGenericSignatureAttribute)cl.getAttribute("Signature"); |
|
|
|
|
StructGenericSignatureAttribute attr = cl.getAttribute(StructGeneralAttribute.ATTRIBUTE_SIGNATURE); |
|
|
|
|
if (attr != null) { |
|
|
|
|
return GenericMain.parseClassSignature(attr.getSignature()); |
|
|
|
|
} |
|
|
|
|