UPPAALModelChecker / UPPAAL-Meta

This is the offcial meta repo for issue reporting, feature request and public roadmap for the development of UPPAAL.
http://www.uppaal.org
1 stars 0 forks source link

ModelDemo.java Compile Error #287

Closed Lqs66 closed 2 months ago

Lqs66 commented 2 months ago

I get the following error when compiling as perjavac -cp lib/model.jar demo/ModelDemo.java:

javac -cp lib/model.jar demo/ModelDemo.java 
demo/ModelDemo.java:26: error: cannot find symbol
import com.uppaal.model.core2.PrototypeDocument;
                             ^
  symbol:   class PrototypeDocument
  location: package com.uppaal.model.core2
demo/ModelDemo.java:35: error: cannot find symbol
import com.uppaal.model.system.concrete.ConcreteTransitionRecord;
                                       ^
  symbol:   class ConcreteTransitionRecord
  location: package com.uppaal.model.system.concrete
demo/ModelDemo.java:159: error: cannot find symbol
        Document doc = new Document(new PrototypeDocument());
                                        ^
  symbol:   class PrototypeDocument
  location: class ModelDemo
demo/ModelDemo.java:199: error: cannot find symbol
            return new PrototypeDocument().load(new URL(location));
                       ^
  symbol:   class PrototypeDocument
  location: class ModelDemo
demo/ModelDemo.java:202: error: cannot find symbol
            return new PrototypeDocument().load(new URL("file", null, location));
                       ^
  symbol:   class PrototypeDocument
  location: class ModelDemo
demo/ModelDemo.java:219: error: cannot find symbol
        engine.setServerPath(path);
              ^
  symbol:   method setServerPath(String)
  location: variable engine of type Engine
demo/ModelDemo.java:220: error: cannot find symbol
        engine.setServerHost("localhost");
              ^
  symbol:   method setServerHost(String)
  location: variable engine of type Engine
demo/ModelDemo.java:221: error: cannot find symbol
        engine.setConnectionMode(EngineStub.BOTH);
                                           ^
  symbol:   variable BOTH
  location: class EngineStub
demo/ModelDemo.java:230: error: incompatible types: SwingFuture<UppaalSystem> cannot be converted to UppaalSystem
        UppaalSystem sys = engine.getSystem(doc, problems);
                                           ^
demo/ModelDemo.java:252: error: incompatible types: SwingFuture<SymbolicState> cannot be converted to SymbolicState
        SymbolicState state = engine.getInitialState(sys);
                                                    ^
demo/ModelDemo.java:258: error: incompatible types: SwingFuture<List<SymbolicTransition>> cannot be converted to ArrayList<SymbolicTransition>
            ArrayList<SymbolicTransition> trans = engine.getTransitions(sys, state);
                                                                       ^
demo/ModelDemo.java:344: error: method query in class Engine cannot be applied to given types;
            System.out.println("Result: " + engine.query(sys, options, query, qf));
                                                  ^
  required: UppaalSystem,Query,QueryFeedback
  found:    UppaalSystem,String,Query,QueryFeedback
  reason: actual and formal argument lists differ in length
demo/ModelDemo.java:349: error: method query in class Engine cannot be applied to given types;
            System.out.println("Result: " + engine.query(sys, options, smcq, qf));
                                                  ^
  required: UppaalSystem,Query,QueryFeedback
  found:    UppaalSystem,String,Query,QueryFeedback
  reason: actual and formal argument lists differ in length
demo/ModelDemo.java:352: error: incompatible types: SwingFuture<SymbolicState> cannot be converted to SymbolicState
            SymbolicState state = engine.getInitialState(sys);
                                                        ^
demo/ModelDemo.java:378: error: method query in class Engine cannot be applied to given types;
            System.out.println("Result: " + engine.query(sys, state, options, query, qf));
                                                  ^
  required: UppaalSystem,Query,QueryFeedback
  found:    UppaalSystem,SymbolicState,String,Query,QueryFeedback
  reason: actual and formal argument lists differ in length
demo/ModelDemo.java:381: error: method query in class Engine cannot be applied to given types;
            System.out.println("Result: " + engine.query(sys, state, options, smcq, qf));
                                                  ^
  required: UppaalSystem,Query,QueryFeedback
  found:    UppaalSystem,SymbolicState,String,Query,QueryFeedback
  reason: actual and formal argument lists differ in length
demo/ModelDemo.java:385: error: method query in class Engine cannot be applied to given types;
            System.out.println("Result: " + engine.query(sys, state, options, smcsim, qf));
                                                  ^
  required: UppaalSystem,Query,QueryFeedback
  found:    UppaalSystem,SymbolicState,String,Query,QueryFeedback
  reason: actual and formal argument lists differ in length
demo/ModelDemo.java:386: error: disconnect() has private access in Engine
            engine.disconnect();
                  ^
demo/ModelDemo.java:437: error: cannot find symbol
        public void setTraceSMC(char result, String feedback, ArrayList<ConcreteTransitionRecord> trace, int cycle,
                                                                        ^
  symbol: class ConcreteTransitionRecord
demo/ModelDemo.java:410: error: <anonymous ModelDemo$1> is not abstract and does not override abstract method setTrace(char,String,ConcreteTrace,QueryResult) in QueryFeedback
    public static QueryFeedback qf = new QueryFeedback() {
                                                         ^
demo/ModelDemo.java:432: error: method does not override or implement a method from a supertype
        @Override
        ^
21 errors

I did not modify the file and compiled it exactly as described in the comment at the beginning of ModelDemo.java.

UPPAAL Version: 5.0.0 Ubuntu: 22.04 Java Version: openjdk-17

mikucionisaau commented 2 months ago

Thank you for the report. There were lots of changes and concurrency fixes in the API and we forgot to update the ModelDemo, I am sorry. I attach the fixed ModelDemo example which works with Uppaal-5.1.0-beta5: ModelDemo-for-UPPAAL-5.1.0-beta5.zip

Please unpack it into your uppaal-5.1.0-beta5/demo directory. The archive has run script which should take care of compiling and launching the example. On Windows the script assumes that UPPAAL_HOME environment variable is set to path where Uppaal is installed.

Lqs66 commented 2 months ago

Thank you for the report. There were lots of changes and concurrency fixes in the API and we forgot to update the ModelDemo, I am sorry. I attach the fixed ModelDemo example which works with Uppaal-5.1.0-beta5: ModelDemo-for-UPPAAL-5.1.0-beta5.zip

Please unpack it into your uppaal-5.1.0-beta5/demo directory. The archive has run script which should take care of compiling and launching the example. On Windows the script assumes that UPPAAL_HOME environment variable is set to path where Uppaal is installed.

Thank you for your reply.