Package org.eclipse.jdt.internal.compiler.env

Examples of org.eclipse.jdt.internal.compiler.env.AccessRuleSet


  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;
  }
View Full Code Here


  if (scope instanceof JavaSearchScope) {
    JavaSearchScope javaSearchScope = (JavaSearchScope) scope;
    // Get document path access restriction from java search scope
    // Note that requestor has to verify if needed whether the document violates the access restriction or not
    AccessRuleSet access = javaSearchScope.getAccessRuleSet(relativePath, containerPath);
    if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the document path
      StringBuffer documentPath = new StringBuffer(containerPath.length() + 1 + relativePath.length());
      documentPath.append(containerPath);
      documentPath.append(separator);
      documentPath.append(relativePath);
View Full Code Here

    char[] pattern = readName(in);
    int problemId = in.readInt();
    accessRules[i] = new ClasspathAccessRule(pattern, problemId);
  }
  JavaModelManager manager = JavaModelManager.getJavaModelManager();
  return new AccessRuleSet(accessRules, in.readByte(), manager.intern(in.readUTF()));
}
View Full Code Here

          classpathEntryName = manager.intern(path.toOSString());
        } else {
          classpathEntryName = manager.intern(path.makeRelative().toString());
        }
      }
      this.accessRuleSet = new AccessRuleSet(rules, classpathEntryType, classpathEntryName);
    }
//    else { -- implicit!
//      this.accessRuleSet = null;
//    }
View Full Code Here

      if (!equalPatterns(this.inclusionPatterns, otherEntry.getInclusionPatterns()))
        return false;
      if (!equalPatterns(this.exclusionPatterns, otherEntry.getExclusionPatterns()))
        return false;
      AccessRuleSet otherRuleSet = otherEntry.getAccessRuleSet();
      if (getAccessRuleSet() != null) {
        if (!getAccessRuleSet().equals(otherRuleSet))
          return false;
      } else if (otherRuleSet != null)
        return false;
View Full Code Here

    ArrayList currentRuleSpecs, String customEncoding,
    String destPath, boolean isSourceOnly,
    boolean rejectDestinationPathOnJars) {

  int rulesSpecsSize = currentRuleSpecs.size();
  AccessRuleSet accessRuleSet = null;
  if (rulesSpecsSize != 0) {
    AccessRule[] accessRules = new AccessRule[currentRuleSpecs.size()];
    boolean rulesOK = true;
    Iterator i = currentRuleSpecs.iterator();
    int j = 0;
    while (i.hasNext()) {
      String ruleSpec = (String) i.next();
      char key = ruleSpec.charAt(0);
      String pattern = ruleSpec.substring(1);
      if (pattern.length() > 0) {
        switch (key) {
          case '+':
            accessRules[j++] = new AccessRule(pattern
                .toCharArray(), 0);
            break;
          case '~':
            accessRules[j++] = new AccessRule(pattern
                .toCharArray(),
                IProblem.DiscouragedReference);
            break;
          case '-':
            accessRules[j++] = new AccessRule(pattern
                .toCharArray(),
                IProblem.ForbiddenReference);
            break;
          case '?':
            accessRules[j++] = new AccessRule(pattern
                .toCharArray(),
                IProblem.ForbiddenReference, true/*keep looking for accessible type*/);
            break;
          default:
            rulesOK = false;
        }
      } else {
        rulesOK = false;
      }
    }
    if (rulesOK) {
        accessRuleSet = new AccessRuleSet(accessRules, AccessRestriction.COMMAND_LINE, currentClasspathName);
    } else {
      if (currentClasspathName.length() != 0) {
        // we go on anyway
        addPendingErrors(this.bind("configure.incorrectClasspath", currentClasspathName));//$NON-NLS-1$
      }
View Full Code Here

    ArrayList currentRuleSpecs, String customEncoding,
    String destPath, boolean isSourceOnly,
    boolean rejectDestinationPathOnJars) {

  int rulesSpecsSize = currentRuleSpecs.size();
  AccessRuleSet accessRuleSet = null;
  if (rulesSpecsSize != 0) {
    AccessRule[] accessRules = new AccessRule[currentRuleSpecs.size()];
    boolean rulesOK = true;
    Iterator i = currentRuleSpecs.iterator();
    int j = 0;
    while (i.hasNext()) {
      String ruleSpec = (String) i.next();
      char key = ruleSpec.charAt(0);
      String pattern = ruleSpec.substring(1);
      if (pattern.length() > 0) {
        switch (key) {
          case '+':
            accessRules[j++] = new AccessRule(pattern
                .toCharArray(), 0);
            break;
          case '~':
            accessRules[j++] = new AccessRule(pattern
                .toCharArray(),
                IProblem.DiscouragedReference);
            break;
          case '-':
            accessRules[j++] = new AccessRule(pattern
                .toCharArray(),
                IProblem.ForbiddenReference);
            break;
          case '?':
            accessRules[j++] = new AccessRule(pattern
                .toCharArray(),
                IProblem.ForbiddenReference, true/*keep looking for accessible type*/);
            break;
          default:
            rulesOK = false;
        }
      } else {
        rulesOK = false;
      }
    }
    if (rulesOK) {
        accessRuleSet = new AccessRuleSet(accessRules, AccessRestriction.COMMAND_LINE, currentClasspathName);
    } else {
      if (currentClasspathName.length() != 0) {
        // we go on anyway
        addPendingErrors(this.bind("configure.incorrectClasspath", currentClasspathName));//$NON-NLS-1$
      }
View Full Code Here

          classpathEntryName = manager.intern(path.toOSString());
        } else {
          classpathEntryName = manager.intern(path.makeRelative().toString());
        }
      }
      this.accessRuleSet = new AccessRuleSet(rules, classpathEntryType, classpathEntryName);
    }
//    else { -- implicit!
//      this.accessRuleSet = null;
//    }
View Full Code Here

      if (!equalPatterns(this.inclusionPatterns, otherEntry.getInclusionPatterns()))
        return false;
      if (!equalPatterns(this.exclusionPatterns, otherEntry.getExclusionPatterns()))
        return false;
      AccessRuleSet otherRuleSet = otherEntry.getAccessRuleSet();
      if (getAccessRuleSet() != null) {
        if (!getAccessRuleSet().equals(otherRuleSet))
          return false;
      } else if (otherRuleSet != null)
        return false;
View Full Code Here

    char[] pattern = readName(in);
    int problemId = in.readInt();
    accessRules[i] = new ClasspathAccessRule(pattern, problemId);
  }
  JavaModelManager manager = JavaModelManager.getJavaModelManager();
  return new AccessRuleSet(accessRules, in.readByte(), manager.intern(in.readUTF()));
}
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.env.AccessRuleSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.