mirror of
https://github.com/moparisthebest/fernflower
synced 2024-11-27 03:32:14 -05:00
deprecation comments generation fixed
This commit is contained in:
parent
e1efc66c86
commit
6c2cc096fb
@ -346,15 +346,28 @@ public class ClassWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// class annotations
|
// class annotations
|
||||||
List<AnnotationExprent> lstAnn = getAllAnnotations(cl.getAttributes());
|
boolean hasDeprecatedAnno = false;
|
||||||
for(AnnotationExprent annexpr : lstAnn) {
|
List<AnnotationExprent> lstAnn = getAllAnnotations(cl.getAttributes());
|
||||||
if("java/lang/Deprecated".equals(annexpr.getClassname())) {
|
for(AnnotationExprent annexpr : lstAnn) {
|
||||||
isDeprecated = false;
|
if("java/lang/Deprecated".equals(annexpr.getClassname())) {
|
||||||
}
|
hasDeprecatedAnno = true;
|
||||||
writer.write(annexpr.toJava(indent));
|
}
|
||||||
writer.newLine();
|
}
|
||||||
}
|
if ((isDeprecated || hasDeprecatedAnno) && DecompilerContext.getOption(IFernflowerPreferences.DEPRECATED_COMMENT)) {
|
||||||
|
writer.write(indstr);
|
||||||
|
writer.write("/** @deprecated */");
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
if(isDeprecated && !hasDeprecatedAnno) {
|
||||||
|
writer.write(indstr);
|
||||||
|
writer.write("@Deprecated");
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
for(AnnotationExprent annexpr : lstAnn) {
|
||||||
|
writer.write(annexpr.toJava(indent));
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || cl.getAttributes().containsKey("Synthetic");
|
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || cl.getAttributes().containsKey("Synthetic");
|
||||||
|
|
||||||
if(isSynthetic) {
|
if(isSynthetic) {
|
||||||
@ -362,19 +375,7 @@ public class ClassWriter {
|
|||||||
writer.write("// $FF: synthetic class");
|
writer.write("// $FF: synthetic class");
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isDeprecated) {
|
|
||||||
if(DecompilerContext.getOption(IFernflowerPreferences.DEPRECATED_COMMENT)) { // special comment for JB
|
|
||||||
writer.write(indstr);
|
|
||||||
writer.write("/** @deprecated */");
|
|
||||||
writer.newLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.write(indstr);
|
|
||||||
writer.write("@Deprecated");
|
|
||||||
writer.newLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.write(indstr);
|
writer.write(indstr);
|
||||||
|
|
||||||
if(isEnum) {
|
if(isEnum) {
|
||||||
@ -488,15 +489,28 @@ public class ClassWriter {
|
|||||||
boolean isDeprecated = fd.getAttributes().containsKey("Deprecated");
|
boolean isDeprecated = fd.getAttributes().containsKey("Deprecated");
|
||||||
|
|
||||||
// field annotations
|
// field annotations
|
||||||
List<AnnotationExprent> lstAnn = getAllAnnotations(fd.getAttributes());
|
boolean hasDeprecatedAnno = false;
|
||||||
for(AnnotationExprent annexpr : lstAnn) {
|
List<AnnotationExprent> lstAnn = getAllAnnotations(fd.getAttributes());
|
||||||
if("java/lang/Deprecated".equals(annexpr.getClassname())) {
|
for(AnnotationExprent annexpr : lstAnn) {
|
||||||
isDeprecated = false;
|
if("java/lang/Deprecated".equals(annexpr.getClassname())) {
|
||||||
}
|
hasDeprecatedAnno = true;
|
||||||
writer.write(annexpr.toJava(indent));
|
}
|
||||||
writer.newLine();
|
}
|
||||||
}
|
if ((isDeprecated || hasDeprecatedAnno) && DecompilerContext.getOption(IFernflowerPreferences.DEPRECATED_COMMENT)) {
|
||||||
|
writer.write(indstr);
|
||||||
|
writer.write("/** @deprecated */");
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
if(isDeprecated && !hasDeprecatedAnno) {
|
||||||
|
writer.write(indstr);
|
||||||
|
writer.write("@Deprecated");
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
for(AnnotationExprent annexpr : lstAnn) {
|
||||||
|
writer.write(annexpr.toJava(indent));
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || fd.getAttributes().containsKey("Synthetic");
|
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || fd.getAttributes().containsKey("Synthetic");
|
||||||
boolean isEnum = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM) && (flags & CodeConstants.ACC_ENUM) != 0;
|
boolean isEnum = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM) && (flags & CodeConstants.ACC_ENUM) != 0;
|
||||||
|
|
||||||
@ -505,18 +519,6 @@ public class ClassWriter {
|
|||||||
writer.write("// $FF: synthetic field");
|
writer.write("// $FF: synthetic field");
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isDeprecated) {
|
|
||||||
if(DecompilerContext.getOption(IFernflowerPreferences.DEPRECATED_COMMENT)) { // special comment for JB
|
|
||||||
writer.write(indstr);
|
|
||||||
writer.write("/** @deprecated */");
|
|
||||||
writer.newLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.write(indstr);
|
|
||||||
writer.write("@Deprecated");
|
|
||||||
writer.newLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.write(indstr);
|
writer.write(indstr);
|
||||||
|
|
||||||
@ -723,16 +725,29 @@ public class ClassWriter {
|
|||||||
bufstrwriter.newLine();
|
bufstrwriter.newLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// method annotations
|
// method annotations
|
||||||
List<AnnotationExprent> lstAnn = getAllAnnotations(mt.getAttributes());
|
boolean hasDeprecatedAnno = false;
|
||||||
for(AnnotationExprent annexpr : lstAnn) {
|
List<AnnotationExprent> lstAnn = getAllAnnotations(mt.getAttributes());
|
||||||
if("java/lang/Deprecated".equals(annexpr.getClassname())) {
|
for(AnnotationExprent annexpr : lstAnn) {
|
||||||
isDeprecated = false;
|
if("java/lang/Deprecated".equals(annexpr.getClassname())) {
|
||||||
}
|
hasDeprecatedAnno = true;
|
||||||
bufstrwriter.write(annexpr.toJava(indent));
|
}
|
||||||
bufstrwriter.newLine();
|
}
|
||||||
}
|
if ((isDeprecated || hasDeprecatedAnno) && DecompilerContext.getOption(IFernflowerPreferences.DEPRECATED_COMMENT)) {
|
||||||
|
writer.write(indstr);
|
||||||
|
writer.write("/** @deprecated */");
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
if(isDeprecated && !hasDeprecatedAnno) {
|
||||||
|
bufstrwriter.write(indstr);
|
||||||
|
bufstrwriter.write("@Deprecated");
|
||||||
|
bufstrwriter.newLine();
|
||||||
|
}
|
||||||
|
for(AnnotationExprent annexpr : lstAnn) {
|
||||||
|
bufstrwriter.write(annexpr.toJava(indent));
|
||||||
|
bufstrwriter.newLine();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || mt.getAttributes().containsKey("Synthetic");
|
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || mt.getAttributes().containsKey("Synthetic");
|
||||||
boolean isBridge = (flags & CodeConstants.ACC_BRIDGE) != 0;
|
boolean isBridge = (flags & CodeConstants.ACC_BRIDGE) != 0;
|
||||||
@ -748,19 +763,7 @@ public class ClassWriter {
|
|||||||
bufstrwriter.write("// $FF: bridge method");
|
bufstrwriter.write("// $FF: bridge method");
|
||||||
bufstrwriter.newLine();
|
bufstrwriter.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isDeprecated) {
|
|
||||||
if(DecompilerContext.getOption(IFernflowerPreferences.DEPRECATED_COMMENT)) { // special comment for JB
|
|
||||||
writer.write(indstr);
|
|
||||||
writer.write("/** @deprecated */");
|
|
||||||
writer.newLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
bufstrwriter.write(indstr);
|
|
||||||
bufstrwriter.write("@Deprecated");
|
|
||||||
bufstrwriter.newLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
bufstrwriter.write(indstr);
|
bufstrwriter.write(indstr);
|
||||||
for(int i=0;i<modval_meth.length;i++) {
|
for(int i=0;i<modval_meth.length;i++) {
|
||||||
if(!isInterface || !mod_notinterface_meth.contains(modval_meth[i])) {
|
if(!isInterface || !mod_notinterface_meth.contains(modval_meth[i])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user