📄 compilationunit.java
字号:
@SuppressWarnings({"unchecked", "cast"}) public List<TypeDecl> getTypeDeclListNoTransform() { return (List<TypeDecl>)getChildNoTransform(1); } // Declared in ClassPath.jrag at line 27 @SuppressWarnings({"unchecked", "cast"}) public String relativeName() { String relativeName_value = relativeName_compute(); return relativeName_value; } private String relativeName_compute() { return relativeName; } // Declared in ClassPath.jrag at line 28 @SuppressWarnings({"unchecked", "cast"}) public String pathName() { String pathName_value = pathName_compute(); return pathName_value; } private String pathName_compute() { return pathName; } // Declared in ClassPath.jrag at line 29 @SuppressWarnings({"unchecked", "cast"}) public boolean fromSource() { boolean fromSource_value = fromSource_compute(); return fromSource_value; } private boolean fromSource_compute() { return fromSource; } // Declared in LookupType.jrag at line 211 @SuppressWarnings({"unchecked", "cast"}) public SimpleSet localLookupType(String name) { SimpleSet localLookupType_String_value = localLookupType_compute(name); return localLookupType_String_value; } private SimpleSet localLookupType_compute(String name) { for(int i = 0; i < getNumTypeDecl(); i++) if(getTypeDecl(i).name().equals(name)) return SimpleSet.emptySet.add(getTypeDecl(i)); return SimpleSet.emptySet; } // Declared in LookupType.jrag at line 218 @SuppressWarnings({"unchecked", "cast"}) public SimpleSet importedTypes(String name) { SimpleSet importedTypes_String_value = importedTypes_compute(name); return importedTypes_String_value; } private SimpleSet importedTypes_compute(String name) { SimpleSet set = SimpleSet.emptySet; for(int i = 0; i < getNumImportDecl(); i++) if(!getImportDecl(i).isOnDemand()) for(Iterator iter = getImportDecl(i).importedTypes(name).iterator(); iter.hasNext(); ) set = set.add(iter.next()); return set; } // Declared in LookupType.jrag at line 226 @SuppressWarnings({"unchecked", "cast"}) public SimpleSet importedTypesOnDemand(String name) { SimpleSet importedTypesOnDemand_String_value = importedTypesOnDemand_compute(name); return importedTypesOnDemand_String_value; } private SimpleSet importedTypesOnDemand_compute(String name) { SimpleSet set = SimpleSet.emptySet; for(int i = 0; i < getNumImportDecl(); i++) if(getImportDecl(i).isOnDemand()) for(Iterator iter = getImportDecl(i).importedTypes(name).iterator(); iter.hasNext(); ) set = set.add(iter.next()); return set; } // Declared in PrettyPrint.jadd at line 780 @SuppressWarnings({"unchecked", "cast"}) public String dumpString() { String dumpString_value = dumpString_compute(); return dumpString_value; } private String dumpString_compute() { return getClass().getName() + " [" + getPackageDecl() + "]"; } protected boolean packageName_computed = false; protected String packageName_value; // Declared in QualifiedNames.jrag at line 92 @SuppressWarnings({"unchecked", "cast"}) public String packageName() { if(packageName_computed) return packageName_value; int num = boundariesCrossed; boolean isFinal = this.is$Final(); packageName_value = packageName_compute(); if(isFinal && num == boundariesCrossed) packageName_computed = true; return packageName_value; } private String packageName_compute() { return getPackageDecl(); } protected boolean destinationPath_computed = false; protected String destinationPath_value; // Declared in ConstantPoolNames.jrag at line 68 @SuppressWarnings({"unchecked", "cast"}) public String destinationPath() { if(destinationPath_computed) return destinationPath_value; int num = boundariesCrossed; boolean isFinal = this.is$Final(); destinationPath_value = destinationPath_compute(); if(isFinal && num == boundariesCrossed) destinationPath_computed = true; return destinationPath_value; } private String destinationPath_compute() { if(Program.hasValueForOption("-d")) { return Program.getValueForOption("-d"); } else { if(fromSource()) { // /home/torbjorn/sandbox/JavaCompiler/JCK/javasoft/sqe/tests/lang/icls045/icls04591m11/icls04591m11_c.java // package javasoft.sqe.tests.lang.icls045.icls04591m11_p class icls04591m11_c // /home/torbjorn/sandbox/JavaCompiler/JCK/javasoft/sqe/tests/lang/icls045/icls04591m11/icls04591m11.java // package javasoft.sqe.tests.lang.icls045.icls04591m11 class icls04591m11 // ta paketnamnet p och om det har fler \ufffdn 3 delar s\ufffd kontrollera om det finns som substring i pathen // anv\ufffdnd i s\ufffd fall den delen av pathen // forts\ufffdtt genom att ta bort sista delen i paketnamnet och g\ufffdr om proceduren // sluta n\ufffdr namnet \ufffdr mindre \ufffdr 3 eller mindre String sourceName = pathName(); //relativeName(); // ex AST/Defines_AST_hello // extract source path including package directories String sourcePath = null; if(sourceName.lastIndexOf(java.io.File.separator) == -1) sourcePath = "."; else sourcePath = sourceName.substring(0, sourceName.lastIndexOf(java.io.File.separator)); String sourcePathPattern = sourcePath.replace(java.io.File.separatorChar, '.'); String[] parts = packageName().split("\\."); int num = parts.length; while(num > 3) { StringBuffer packagePattern = new StringBuffer(); for(int i = 0; i < num; i++) { if(i != 0) packagePattern.append("."); packagePattern.append(parts[i]); } int index = sourcePathPattern.lastIndexOf(packagePattern.toString()); if(index > 0) { return sourcePath.substring(0, index-1); } num--; } //System.err.println("SourcePath: " + sourcePath); //String[] parts = packageName().split("\\."); int k = parts.length - 1; while(k >= 0 && !sourcePath.endsWith(parts[k])) { //System.err.println(sourcePath + " does not end with " + parts[k]); k--; } if(k >= 0) { for(int i = k; i >= 0; i--) { sourcePath = sourcePath.substring(0, sourcePath.lastIndexOf(parts[i])); //System.err.println("new candidate is " + sourcePath); } } if(sourcePath.equals("")) sourcePath = "."; //System.err.println("SourcePath after: " + sourcePath); return sourcePath; /* // extract first part of package name String prefix; int pos = packageName().indexOf('.'); // AST if(pos != -1) prefix = packageName().substring(0, pos-1); else prefix = packageName(); // add separator prefix = prefix + java.io.File.separator; // find last occurance pos = sourceName.lastIndexOf(prefix); if(pos > 0 && !packageName().equals("")) return sourceName.substring(0, pos-1); */ } if(pathName != null) return pathName; else return "."; } } // Declared in LookupType.jrag at line 99 @SuppressWarnings({"unchecked", "cast"}) public TypeDecl lookupType(String packageName, String typeName) { TypeDecl lookupType_String_String_value = getParent().Define_TypeDecl_lookupType(this, null, packageName, typeName); return lookupType_String_String_value; } protected java.util.Map lookupType_String_values; // Declared in LookupType.jrag at line 171 @SuppressWarnings({"unchecked", "cast"}) public SimpleSet lookupType(String name) { Object _parameters = name;if(lookupType_String_values == null) lookupType_String_values = new java.util.HashMap(4); if(lookupType_String_values.containsKey(_parameters)) return (SimpleSet)lookupType_String_values.get(_parameters); int num = boundariesCrossed; boolean isFinal = this.is$Final(); SimpleSet lookupType_String_value = getParent().Define_SimpleSet_lookupType(this, null, name); if(isFinal && num == boundariesCrossed) lookupType_String_values.put(_parameters, lookupType_String_value); return lookupType_String_value; } // Declared in TypeAnalysis.jrag at line 494 public TypeDecl Define_TypeDecl_enclosingType(ASTNode caller, ASTNode child) { if(true) { int childIndex = this.getIndexOfChild(caller); return null; } return getParent().Define_TypeDecl_enclosingType(this, caller); } // Declared in ExceptionHandling.jrag at line 117 public boolean Define_boolean_handlesException(ASTNode caller, ASTNode child, TypeDecl exceptionType) { if(caller == getTypeDeclListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return !exceptionType.isUncheckedException(); } return getParent().Define_boolean_handlesException(this, caller, exceptionType); } // Declared in TypeAnalysis.jrag at line 565 public String Define_String_hostPackage(ASTNode caller, ASTNode child) { if(true) { int childIndex = this.getIndexOfChild(caller); return packageName(); } return getParent().Define_String_hostPackage(this, caller); } // Declared in TypeAnalysis.jrag at line 581 public TypeDecl Define_TypeDecl_hostType(ASTNode caller, ASTNode child) { if(caller == getImportDeclListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return null; } return getParent().Define_TypeDecl_hostType(this, caller); } // Declared in ConstantPoolNames.jrag at line 66 public String Define_String_destinationPath(ASTNode caller, ASTNode child) { if(caller == getImportDeclListNoTransform()) { int index = caller.getIndexOfChild(child); return destinationPath(); } if(caller == getTypeDeclListNoTransform()) { int index = caller.getIndexOfChild(child); return destinationPath(); } return getParent().Define_String_destinationPath(this, caller); } // Declared in NameCheck.jrag at line 27 public SimpleSet Define_SimpleSet_allImportedTypes(ASTNode caller, ASTNode child, String name) { if(caller == getImportDeclListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return importedTypes(name); } return getParent().Define_SimpleSet_allImportedTypes(this, caller, name); } // Declared in QualifiedNames.jrag at line 90 public String Define_String_packageName(ASTNode caller, ASTNode child) { if(true) { int childIndex = this.getIndexOfChild(caller); return packageName(); } return getParent().Define_String_packageName(this, caller); } // Declared in TypeAnalysis.jrag at line 531 public boolean Define_boolean_isMemberType(ASTNode caller, ASTNode child) { if(caller == getTypeDeclListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return false; } return getParent().Define_boolean_isMemberType(this, caller); } // Declared in DefiniteAssignment.jrag at line 51 public boolean Define_boolean_isIncOrDec(ASTNode caller, ASTNode child) { if(caller == getTypeDeclListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return false; } return getParent().Define_boolean_isIncOrDec(this, caller); } // Declared in TypeAnalysis.jrag at line 543 public boolean Define_boolean_isLocalClass(ASTNode caller, ASTNode child) { if(true) { int childIndex = this.getIndexOfChild(caller); return false; } return getParent().Define_boolean_isLocalClass(this, caller); } // Declared in TypeAnalysis.jrag at line 521 public boolean Define_boolean_isNestedType(ASTNode caller, ASTNode child) { if(true) { int childIndex = this.getIndexOfChild(caller); return false; } return getParent().Define_boolean_isNestedType(this, caller); } // Declared in SyntacticClassification.jrag at line 69 public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) { if(caller == getImportDeclListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return NameType.PACKAGE_NAME; } return getParent().Define_NameType_nameType(this, caller); } // Declared in LookupType.jrag at line 267 public SimpleSet Define_SimpleSet_lookupType(ASTNode caller, ASTNode child, String name) { if(caller == getImportDeclListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return lookupType(name); } if(true) { int childIndex = this.getIndexOfChild(caller);{ // locally declared types in compilation unit SimpleSet set = localLookupType(name); if(!set.isEmpty()) return set; // imported types set = importedTypes(name); if(!set.isEmpty()) return set; // types in the same package TypeDecl result = lookupType(packageName(), name); if(result != null && result.accessibleFromPackage(packageName())) return SimpleSet.emptySet.add(result); // types imported on demand set = importedTypesOnDemand(name); if(!set.isEmpty()) return set; // include primitive types result = lookupType(PRIMITIVE_PACKAGE_NAME, name); if(result != null) return SimpleSet.emptySet.add(result); // 7.5.5 Automatic Imports result = lookupType("java.lang", name); if(result != null && result.accessibleFromPackage(packageName())) return SimpleSet.emptySet.add(result); return lookupType(name); }} return getParent().Define_SimpleSet_lookupType(this, caller, name); } // Declared in ClassPath.jrag at line 32 public CompilationUnit Define_CompilationUnit_compilationUnit(ASTNode caller, ASTNode child) { if(true) { int childIndex = this.getIndexOfChild(caller); return this; } return getParent().Define_CompilationUnit_compilationUnit(this, caller); }public ASTNode rewriteTo() { return super.rewriteTo();}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -