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

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


    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 {
        return;
      }
    }
    if (Main.NONE.equals(destPath)) {
View Full Code Here

    if (this.checkAccessRestrictions && (isBinary || !type.getJavaProject().equals(this.project))) {
      PackageFragmentRoot root = (PackageFragmentRoot)type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
      ClasspathEntry entry = (ClasspathEntry) this.nameLookup.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);
          char[] fileWithoutExtension = type.getElementName().toCharArray();
          accessRestriction = accessRuleSet.getViolatedRestriction(CharOperation.concatWith(packageChars, fileWithoutExtension, '/'));
        }
      }
    }
    this.requestor.acceptType(packageName, type.getElementName().toCharArray(), null, type.getFlags(), accessRestriction);
  } catch (JavaModelException jme) {
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, index.containerPath);
      if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the path
        if (!requestor.acceptIndexMatch(documentPath, this, participant, access))
          throw new OperationCanceledException();
      }
    } else if (scope.encloses(documentPath)) {
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, index.containerPath);
    if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the path
      if (!requestor.acceptIndexMatch(documentPath, this, participant, access))
        throw new OperationCanceledException();
    }
  } else if (scope.encloses(documentPath)) {
View Full Code Here

  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

  IClasspathEntry[] entries = javaProject.getResolvedClasspath();
  IJavaModel model = javaProject.getJavaModel();
  JavaModelManager.PerProjectInfo perProjectInfo = javaProject.getPerProjectInfo();
  for (int i = 0, length = entries.length; i < length; i++) {
    IClasspathEntry entry = entries[i];
    AccessRuleSet access = null;
    ClasspathEntry cpEntry = (ClasspathEntry) entry;
    if (referringEntry != null) {
      // Add only exported entries.
      // Source folder are implicitly exported.
      if (!entry.isExported() && entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) {
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.