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

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


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

  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) {
      String templates[] = new String[AccessRuleSet.MESSAGE_TEMPLATES_LENGTH];
      templates[0] = this.bind(
          "template.restrictedAccess.type", //$NON-NLS-1$
          new String[] {"{0}", currentClasspathName}); //$NON-NLS-1$
      templates[1] = this.bind(
          "template.restrictedAccess.constructor", //$NON-NLS-1$
          new String[] {"{0}", currentClasspathName}); //$NON-NLS-1$
      templates[2] = this.bind(
          "template.restrictedAccess.method", //$NON-NLS-1$
          new String[] {"{0}", "{1}", currentClasspathName}); //$NON-NLS-1$ //$NON-NLS-2$
      templates[3] = this.bind(
          "template.restrictedAccess.field", //$NON-NLS-1$
          new String[] {"{0}", "{1}", currentClasspathName}); //$NON-NLS-1$ //$NON-NLS-2$
      accessRuleSet = new AccessRuleSet(accessRules, templates);
    } else {
      if (currentClasspathName.length() != 0) {
        // we go on anyway
        this.logger.logIncorrectClasspath(currentClasspathName);
      }
View Full Code Here


    int length;
    if (accessRules != null && (length = accessRules.length) > 0) {
      AccessRule[] rules = new AccessRule[length];
      System.arraycopy(accessRules, 0, rules, 0, length);
      this.accessRuleSet = new AccessRuleSet(rules, getMessageTemplates());
    }
//    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

    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
        String documentPath = documentPath(containerPath, relativePath);
        if (!requestor.acceptIndexMatch(documentPath, pattern, participant, access))
          throw new OperationCanceledException();
      }
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

  JavaModelManager manager = JavaModelManager.getJavaModelManager();
  String[] messageTemplates = new String[AccessRuleSet.MESSAGE_TEMPLATES_LENGTH];
  for (int i = 0; i < AccessRuleSet.MESSAGE_TEMPLATES_LENGTH; i++) {
    messageTemplates[i] = manager.intern(in.readUTF());
  }
  AccessRuleSet accessRuleSet = new AccessRuleSet(accessRules, messageTemplates);
  return accessRuleSet;
}
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) continue;
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

  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

TOP

Related Classes of org.aspectj.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.