Exemple #1
0
 /**
  * Require variable declarations to include an explicit type. The result is {@code false} if the
  * remote JVM is unavailable or if an exception occurs. Blocks until the interpreter is connected.
  */
 public boolean setRequireVariableType(boolean require) {
   InterpreterJVMRemoteI remote = _state.value().interpreter(false);
   if (remote == null) {
     return false;
   }
   try {
     remote.setRequireVariableType(require);
     return true;
   } catch (RemoteException e) {
     _handleRemoteException(e);
     return false;
   }
 }
Exemple #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);
      }
    }