Пример #1
0
 /**
  * Sets the interpreter to enforce access to all members. The result is {@code false} if the
  * remote JVM is unavailable or if an exception occurs. Blocks until the interpreter is connected.
  */
 public boolean setEnforceAllAccess(boolean enforce) {
   InterpreterJVMRemoteI remote = _state.value().interpreter(false);
   if (remote == null) {
     return false;
   }
   try {
     remote.setEnforceAllAccess(enforce);
     return true;
   } catch (RemoteException e) {
     _handleRemoteException(e);
     return false;
   }
 }
Пример #2
0
    @Override
    public void started(InterpreterJVMRemoteI i) {
      if (_state.compareAndSet(this, new FreshRunningState(i))) {
        boolean enforceAllAccess =
            DrJava.getConfig()
                .getSetting(OptionConstants.DYNAMICJAVA_ACCESS_CONTROL)
                .equals(
                    OptionConstants.DynamicJavaAccessControlChoices.PRIVATE_AND_PACKAGE); // "all"
        try {
          i.setEnforceAllAccess(enforceAllAccess);
        } catch (RemoteException re) {
          _handleRemoteException(re);
        }

        boolean enforcePrivateAccess =
            !DrJava.getConfig()
                .getSetting(OptionConstants.DYNAMICJAVA_ACCESS_CONTROL)
                .equals(OptionConstants.DynamicJavaAccessControlChoices.DISABLED); // not "none"
        try {
          i.setEnforcePrivateAccess(enforcePrivateAccess);
        } catch (RemoteException re) {
          _handleRemoteException(re);
        }

        Boolean requireSemicolon =
            DrJava.getConfig().getSetting(OptionConstants.DYNAMICJAVA_REQUIRE_SEMICOLON);
        try {
          i.setRequireSemicolon(requireSemicolon);
        } catch (RemoteException re) {
          _handleRemoteException(re);
        }

        Boolean requireVariableType =
            DrJava.getConfig().getSetting(OptionConstants.DYNAMICJAVA_REQUIRE_VARIABLE_TYPE);
        try {
          i.setRequireVariableType(requireVariableType);
        } catch (RemoteException re) {
          _handleRemoteException(re);
        }

        // Note that _workingDir isn't guaranteed to be the dir at the time startup began.  Is that
        // a problem?
        // (Is the user ever going to see a working dir message that doesn't match the actual
        // setting?)
        _interactionsModel.interpreterReady(_workingDir);
        _junitModel.junitJVMReady();
      } else {
        _state.value().started(i);
      }
    }