Skip to content

Commit 7a4287f

Browse files
committed
fix for static ENUM reference not using $incl$
1 parent 9c52726 commit 7a4287f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/Java2ScriptVisitor.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,17 +2512,22 @@ public boolean visit(PrefixExpression node) {
25122512

25132513
public boolean visit(QualifiedName node) {
25142514
// page.x =...
2515+
2516+
25152517
if (NameMapper.isJ2SSimpleQualified(node) && getConstantValue(node, true))
25162518
return false;
25172519
IBinding nameBinding = node.resolveBinding();
25182520
IVariableBinding varBinding = (nameBinding instanceof IVariableBinding ? (IVariableBinding) nameBinding : null);
25192521
ASTNode parent = node.getParent();
25202522
Name qualifier = node.getQualifier();
2521-
if (!checkStaticBinding(varBinding) || qualifier.resolveBinding() instanceof ITypeBinding)
2523+
boolean skipQualifier = false;
2524+
if (isStatic(nameBinding) && varBinding != null) {
2525+
addQualifiedNameFromBinding(varBinding);
2526+
buffer.append('.');
2527+
skipQualifier = true;
2528+
} else if (!checkStaticBinding(varBinding) || qualifier.resolveBinding() instanceof ITypeBinding) {
25222529
varBinding = null;
2523-
boolean skipQualifier = false;// (allowExtensions &&
2524-
// ExtendedAdapter.isHTMLClass(qualifier.toString(),
2525-
// true));
2530+
}
25262531
String className = null;
25272532
if (!skipQualifier && parent != null && !(parent instanceof QualifiedName)) {
25282533
while (qualifier instanceof QualifiedName) {
@@ -2558,7 +2563,7 @@ public boolean visit(QualifiedName node) {
25582563
className = className.substring(10);
25592564
}
25602565
if (isStatic(nameBinding)) {
2561-
className = getQualifiedStaticName(null, className, true, true, false);
2566+
className = getQualifiedStaticName(null, className, true, true, false);
25622567
}
25632568
}
25642569
}
@@ -2720,15 +2725,13 @@ private String simpleNameInVarBinding(SimpleName node, char ch, IVariableBinding
27202725
name = assureQualifiedName(name);
27212726
if (name.length() != 0) {
27222727
ret = getQualifiedStaticName(null, name, true, true, false) + ".";
2723-
//ch = '.';
27242728
}
27252729
}
27262730
} else {
27272731
ASTNode parent = node.getParent();
27282732
if (parent != null && !(parent instanceof FieldAccess)) {
27292733
if (declaringClass != null && getUnqualifiedClassName() != null && ch != '.') {
27302734
ret = getClassNameAndDot(parent, declaringClass, false);
2731-
//ch = '.';
27322735
}
27332736
}
27342737
String fieldVar = null;
@@ -2758,7 +2761,7 @@ private String simpleNameInVarBinding(SimpleName node, char ch, IVariableBinding
27582761
}
27592762
if (declaringClass != null)
27602763
name = NameMapper.getJ2SName(node);
2761-
ret += NameMapper.getJ2SCheckedFieldName(declaringClass, name);//, ch != '.');
2764+
ret += NameMapper.getJ2SCheckedFieldName(declaringClass, name);
27622765
return ret;
27632766
}
27642767

@@ -4406,6 +4409,7 @@ private void setMapJavaDoc(PackageDeclaration node) {
44064409
* check any node other than the package node for @j2sNative or @j2sDebug or @j2sIgnore
44074410
*/
44084411
public boolean preVisit2(ASTNode node) {
4412+
//buffer.append("\nvisiting " + node.getStartPosition() + node.getClass().getName() + "\n");
44094413
List<Javadoc> j2sJavadoc;
44104414
if ( global_mapBlockJavadoc == null
44114415
|| node instanceof MethodDeclaration
@@ -4414,7 +4418,6 @@ public boolean preVisit2(ASTNode node) {
44144418
return true;
44154419
boolean isBlock = (node instanceof Block);
44164420
boolean ret = !NativeDoc.checkJ2sJavadocs(buffer, j2sJavadoc, isBlock, global_j2sFlag_isDebugging) || !isBlock;
4417-
//buffer.append("visiting " + node.getStartPosition() + " " + isBlock + " " + ret);
44184421
return ret;
44194422
}
44204423

0 commit comments

Comments
 (0)