/** * Return the first access rule which is violated when accessing a given * type, or null if no 'non accessible' access rule applies. * * @param qualifiedBinaryFileName * tested type specification, formed as: * "org/eclipse/jdt/core/JavaCore.class"; on systems that * use \ as File.separator, the * "org\eclipse\jdt\core\JavaCore.class" is accepted as well * @return the first access rule which is violated when accessing a given * type, or null if none applies */ protected AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) { if (this.accessRuleSet == null) return null; char [] qualifiedTypeName = qualifiedBinaryFileName. substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length) .toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(qualifiedTypeName, File.separatorChar, '/'); } return this.accessRuleSet.getViolatedRestriction(qualifiedTypeName); }
/** * Return the first access rule which is violated when accessing a given * type, or null if no 'non accessible' access rule applies. * * @param qualifiedBinaryFileName * tested type specification, formed as: * "org/eclipse/jdt/core/JavaCore.class"; on systems that * use \ as File.separator, the * "org\eclipse\jdt\core\JavaCore.class" is accepted as well * @return the first access rule which is violated when accessing a given * type, or null if none applies */ protected AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) { if (this.accessRuleSet == null) return null; char [] qualifiedTypeName = qualifiedBinaryFileName. substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length) .toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(qualifiedTypeName, File.separatorChar, '/'); } return this.accessRuleSet.getViolatedRestriction(qualifiedTypeName); }
/** * Return the first access rule which is violated when accessing a given * type, or null if no 'non accessible' access rule applies. * * @param qualifiedBinaryFileName * tested type specification, formed as: * "org/eclipse/jdt/core/JavaCore.class"; on systems that * use \ as File.separator, the * "org\eclipse\jdt\core\JavaCore.class" is accepted as well * @return the first access rule which is violated when accessing a given * type, or null if none applies */ protected AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) { if (this.accessRuleSet == null) return null; char [] qualifiedTypeName = qualifiedBinaryFileName. substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length) .toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(qualifiedTypeName, File.separatorChar, '/'); } return this.accessRuleSet.getViolatedRestriction(qualifiedTypeName); }
/** * Return the first access rule which is violated when accessing a given * type, or null if no 'non accessible' access rule applies. * * @param qualifiedBinaryFileName * tested type specification, formed as: * "org/eclipse/jdt/core/JavaCore.class"; on systems that * use \ as File.separator, the * "org\eclipse\jdt\core\JavaCore.class" is accepted as well * @return the first access rule which is violated when accessing a given * type, or null if none applies */ protected AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) { if (this.accessRuleSet == null) return null; char [] qualifiedTypeName = qualifiedBinaryFileName. substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length) .toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(qualifiedTypeName, File.separatorChar, '/'); } return this.accessRuleSet.getViolatedRestriction(qualifiedTypeName); }
/** * Return the first access rule which is violated when accessing a given * type, or null if no 'non accessible' access rule applies. * * @param qualifiedBinaryFileName * tested type specification, formed as: * "org/eclipse/jdt/core/JavaCore.class"; on systems that * use \ as File.separator, the * "org\eclipse\jdt\core\JavaCore.class" is accepted as well * @return the first access rule which is violated when accessing a given * type, or null if none applies */ protected AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) { if (this.accessRuleSet == null) return null; char [] qualifiedTypeName = qualifiedBinaryFileName. substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length) .toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(qualifiedTypeName, File.separatorChar, '/'); } return this.accessRuleSet.getViolatedRestriction(qualifiedTypeName); }
/** * Return the first access rule which is violated when accessing a given * type, or null if no 'non accessible' access rule applies. * * @param qualifiedBinaryFileName * tested type specification, formed as: * "org/eclipse/jdt/core/JavaCore.class"; on systems that * use \ as File.separator, the * "org\eclipse\jdt\core\JavaCore.class" is accepted as well * @return the first access rule which is violated when accessing a given * type, or null if none applies */ protected AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) { if (this.accessRuleSet == null) return null; char [] qualifiedTypeName = qualifiedBinaryFileName. substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length) .toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(qualifiedTypeName, File.separatorChar, '/'); } return this.accessRuleSet.getViolatedRestriction(qualifiedTypeName); }
/** * Return the first access rule which is violated when accessing a given * type, or null if no 'non accessible' access rule applies. * * @param qualifiedBinaryFileName * tested type specification, formed as: * "org/eclipse/jdt/core/JavaCore.class"; on systems that * use \ as File.separator, the * "org\eclipse\jdt\core\JavaCore.class" is accepted as well * @return the first access rule which is violated when accessing a given * type, or null if none applies */ protected AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) { if (this.accessRuleSet == null) return null; char [] qualifiedTypeName = qualifiedBinaryFileName. substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length) .toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(qualifiedTypeName, File.separatorChar, '/'); } return this.accessRuleSet.getViolatedRestriction(qualifiedTypeName); }
private AccessRestriction getViolatedRestriction(String typeName, String packageName, ClasspathEntry entry, AccessRestriction accessRestriction) { AccessRuleSet accessRuleSet = entry.getAccessRuleSet(); if (accessRuleSet != null) { // TODO (philippe) improve char[] <-> String conversions to avoid performing them on the fly char[][] packageChars = CharOperation.splitOn('.', packageName.toCharArray()); char[] typeChars = typeName.toCharArray(); accessRestriction = accessRuleSet.getViolatedRestriction(CharOperation.concatWith(packageChars, typeChars, '/')); } return accessRestriction; }
private AccessRestriction getViolatedRestriction(String typeName, String packageName, ClasspathEntry entry, AccessRestriction accessRestriction) { AccessRuleSet accessRuleSet = entry.getAccessRuleSet(); if (accessRuleSet != null) { // TODO (philippe) improve char[] <-> String conversions to avoid performing them on the fly char[][] packageChars = CharOperation.splitOn('.', packageName.toCharArray()); char[] typeChars = typeName.toCharArray(); accessRestriction = accessRuleSet.getViolatedRestriction(CharOperation.concatWith(packageChars, typeChars, '/')); } return accessRestriction; }
private AccessRestriction getViolatedRestriction(String typeName, String packageName, ClasspathEntry entry, AccessRestriction accessRestriction) { AccessRuleSet accessRuleSet = entry.getAccessRuleSet(); if (accessRuleSet != null) { // TODO (philippe) improve char[] <-> String conversions to avoid performing them on the fly char[][] packageChars = CharOperation.splitOn('.', packageName.toCharArray()); char[] typeChars = typeName.toCharArray(); accessRestriction = accessRuleSet.getViolatedRestriction(CharOperation.concatWith(packageChars, typeChars, '/')); } return accessRestriction; }
private AccessRestriction getViolatedRestriction(String typeName, String packageName, IType type, AccessRestriction accessRestriction) { PackageFragmentRoot root = (PackageFragmentRoot) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); ClasspathEntry entry = (ClasspathEntry) this.rootToResolvedEntries.get(root); if (entry != null) { // reverse map always contains resolved CP entry AccessRuleSet accessRuleSet = entry.getAccessRuleSet(); if (accessRuleSet != null) { // TODO (philippe) improve char[] <-> String conversions to avoid performing them on the fly char[][] packageChars = CharOperation.splitOn('.', packageName.toCharArray()); char[] typeChars = typeName.toCharArray(); accessRestriction = accessRuleSet.getViolatedRestriction(CharOperation.concatWith(packageChars, typeChars, '/')); } } return accessRestriction; }
private AccessRestriction getViolatedRestriction(String typeName, String packageName, IType type, AccessRestriction accessRestriction) { PackageFragmentRoot root = (PackageFragmentRoot) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); ClasspathEntry entry = (ClasspathEntry) this.rootToResolvedEntries.get(root); if (entry != null) { // reverse map always contains resolved CP entry AccessRuleSet accessRuleSet = entry.getAccessRuleSet(); if (accessRuleSet != null) { // TODO (philippe) improve char[] <-> String conversions to avoid performing them on the fly char[][] packageChars = CharOperation.splitOn('.', packageName.toCharArray()); char[] typeChars = typeName.toCharArray(); accessRestriction = accessRuleSet.getViolatedRestriction(CharOperation.concatWith(packageChars, typeChars, '/')); } } return accessRestriction; }
private AccessRestriction getViolatedRestriction(String typeName, String packageName, IType type, AccessRestriction accessRestriction) { PackageFragmentRoot root = (PackageFragmentRoot) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); ClasspathEntry entry = (ClasspathEntry) this.rootToResolvedEntries.get(root); if (entry != null) { // reverse map always contains resolved CP entry AccessRuleSet accessRuleSet = entry.getAccessRuleSet(); if (accessRuleSet != null) { // TODO (philippe) improve char[] <-> String conversions to avoid performing them on the fly char[][] packageChars = CharOperation.splitOn('.', packageName.toCharArray()); char[] typeChars = typeName.toCharArray(); accessRestriction = accessRuleSet.getViolatedRestriction(CharOperation.concatWith(packageChars, typeChars, '/')); } } return accessRestriction; }
public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) { if (!isPackage(qualifiedPackageName)) return null; // most common case try { ClassFileReader reader = ClassFileReader.read(this.zipFile, qualifiedBinaryFileName); if (reader != null) { if (this.accessRuleSet == null) return new NameEnvironmentAnswer(reader, null); String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length); return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray())); } } catch (IOException e) { // treat as if class file is missing } catch (ClassFormatException e) { // treat as if class file is missing } return null; }
public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) { if (!isPackage(qualifiedPackageName)) return null; // most common case try { ClassFileReader reader = ClassFileReader.read(this.zipFile, qualifiedBinaryFileName); if (reader != null) { if (this.accessRuleSet == null) return new NameEnvironmentAnswer(reader, null); String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length); return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray())); } } catch (IOException e) { // treat as if class file is missing } catch (ClassFormatException e) { // treat as if class file is missing } return null; }
public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) { if (!isPackage(qualifiedPackageName)) return null; // most common case try { ClassFileReader reader = ClassFileReader.read(this.zipFile, qualifiedBinaryFileName); if (reader != null) { if (this.accessRuleSet == null) return new NameEnvironmentAnswer(reader, null); String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length); return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray())); } } catch (IOException e) { // treat as if class file is missing } catch (ClassFormatException e) { // treat as if class file is missing } return null; }
public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) { if (!doesFileExist(binaryFileName, qualifiedPackageName, qualifiedBinaryFileName)) return null; // most common case ClassFileReader reader = null; try { reader = Util.newClassFileReader(this.binaryFolder.getFile(new Path(qualifiedBinaryFileName))); } catch (CoreException e) { return null; } catch (ClassFormatException e) { return null; } catch (IOException e) { return null; } if (reader != null) { if (this.accessRuleSet == null) return new NameEnvironmentAnswer(reader, null); String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length); return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray())); } return null; }
public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) { if (!doesFileExist(binaryFileName, qualifiedPackageName, qualifiedBinaryFileName)) return null; // most common case ClassFileReader reader = null; try { reader = Util.newClassFileReader(this.binaryFolder.getFile(new Path(qualifiedBinaryFileName))); } catch (CoreException e) { return null; } catch (ClassFormatException e) { return null; } catch (IOException e) { return null; } if (reader != null) { if (this.accessRuleSet == null) return new NameEnvironmentAnswer(reader, null); String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length); return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray())); } return null; }
public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) { if (!doesFileExist(binaryFileName, qualifiedPackageName, qualifiedBinaryFileName)) return null; // most common case ClassFileReader reader = null; try { reader = Util.newClassFileReader(this.binaryFolder.getFile(new Path(qualifiedBinaryFileName))); } catch (CoreException e) { return null; } catch (ClassFormatException e) { return null; } catch (IOException e) { return null; } if (reader != null) { if (this.accessRuleSet == null) return new NameEnvironmentAnswer(reader, null); String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length); return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray())); } return null; }
public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) { if (!isPackage(qualifiedPackageName)) return null; // most common case try { ClassFileReader reader = ClassFileReader.read(this.zipFile, qualifiedBinaryFileName); if (reader != null) { String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length); if (this.externalAnnotationPath != null) { try { this.annotationZipFile = reader.setExternalAnnotationProvider(this.externalAnnotationPath, fileNameWithoutExtension, this.annotationZipFile, null); } catch (IOException e) { // don't let error on annotations fail class reading } } if (this.accessRuleSet == null) return new NameEnvironmentAnswer(reader, null); return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray())); } } catch (IOException e) { // treat as if class file is missing } catch (ClassFormatException e) { // treat as if class file is missing } return null; }