mirror of
https://github.com/java-decompiler/jd-gui.git
synced 2025-01-30 00:22:11 +00:00
Fixes errors in JavaFileTypeFactoryProvider
This commit is contained in:
parent
a6bffe6f7a
commit
c2d7d4d2cb
@ -210,7 +210,12 @@ public class JavaFileTypeFactoryProvider extends AbstractTypeFactoryProvider {
|
||||
superQualifiedTypeName = resolveInternalTypeName(superType.classOrInterfaceType().Identifier());
|
||||
}
|
||||
|
||||
access += getTypeDeclarationContextAccessFlag(ctx.getParent());
|
||||
ParserRuleContext parent = ctx.getParent();
|
||||
|
||||
if (parent instanceof JavaParser.TypeDeclarationContext)
|
||||
access += getTypeDeclarationContextAccessFlag(parent);
|
||||
else if (parent instanceof JavaParser.MemberDeclarationContext)
|
||||
access += getMemberDeclarationContextAccessFlag(parent.getParent());
|
||||
|
||||
if (currentType == null) {
|
||||
String internalTypeName = packageName.isEmpty() ? name : packageName + "/" + name;
|
||||
@ -317,8 +322,6 @@ public class JavaFileTypeFactoryProvider extends AbstractTypeFactoryProvider {
|
||||
|
||||
public void enterConstructorDeclaration(JavaParser.ConstructorDeclarationContext ctx) {
|
||||
int access = getClassBodyDeclarationAccessFlag(ctx.getParent().getParent());
|
||||
TerminalNode identifier = ctx.Identifier();
|
||||
String name = identifier.getText();
|
||||
String paramDescriptors = createParamDescriptors(ctx.formalParameters().formalParameterList());
|
||||
String descriptor = paramDescriptors + "V";
|
||||
|
||||
@ -344,14 +347,28 @@ public class JavaFileTypeFactoryProvider extends AbstractTypeFactoryProvider {
|
||||
protected int getTypeDeclarationContextAccessFlag(ParserRuleContext ctx) {
|
||||
int access = 0;
|
||||
|
||||
for (JavaParser.ClassOrInterfaceModifierContext modifierContext : ctx.getRuleContexts(JavaParser.ClassOrInterfaceModifierContext.class)) {
|
||||
access += getAccessFlag(modifierContext);
|
||||
for (JavaParser.ClassOrInterfaceModifierContext coiModifierContext : ctx.getRuleContexts(JavaParser.ClassOrInterfaceModifierContext.class)) {
|
||||
access += getAccessFlag(coiModifierContext);
|
||||
}
|
||||
|
||||
return access;
|
||||
}
|
||||
|
||||
protected int getMemberDeclarationContextAccessFlag(ParserRuleContext ctx) {
|
||||
int access = 0;
|
||||
|
||||
for (JavaParser.ModifierContext modifierContext : ctx.getRuleContexts(JavaParser.ModifierContext.class)) {
|
||||
JavaParser.ClassOrInterfaceModifierContext coiModifierContext = modifierContext.classOrInterfaceModifier();
|
||||
if (coiModifierContext != null) {
|
||||
access += getAccessFlag(coiModifierContext);
|
||||
}
|
||||
}
|
||||
|
||||
return access;
|
||||
}
|
||||
|
||||
protected int getClassBodyDeclarationAccessFlag(ParserRuleContext ctx) {
|
||||
if ((currentType.access & JavaType.FLAG_INTERFACE) == 0) {
|
||||
int access = 0;
|
||||
|
||||
for (JavaParser.ModifierContext modifierContext : ctx.getRuleContexts(JavaParser.ModifierContext.class)) {
|
||||
@ -363,6 +380,9 @@ public class JavaFileTypeFactoryProvider extends AbstractTypeFactoryProvider {
|
||||
}
|
||||
|
||||
return access;
|
||||
} else {
|
||||
return JavaType.FLAG_PUBLIC;
|
||||
}
|
||||
}
|
||||
|
||||
protected int getAccessFlag(JavaParser.ClassOrInterfaceModifierContext ctx) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user