Skip to content

Commit

Permalink
move static analyser package into eol.engine plugin.
Browse files Browse the repository at this point in the history
resolve circular import and related errors
  • Loading branch information
pkourouklidis committed Nov 19, 2024
1 parent 92c2208 commit ca71017
Show file tree
Hide file tree
Showing 53 changed files with 34 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Bundle-SymbolicName: org.eclipse.epsilon.ecl.staticanalyser
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.eclipse.epsilon.ecl.staticanalysis
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.epsilon.eol.staticanalyser,
Require-Bundle: org.eclipse.epsilon.eol.engine,
org.eclipse.epsilon.ecl.engine
Export-Package: org.eclipse.epsilon.ecl.staticanalyser
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
import org.eclipse.epsilon.eol.dom.Expression;
import org.eclipse.epsilon.eol.dom.StatementBlock;
import org.eclipse.epsilon.eol.execute.context.FrameType;
import org.eclipse.epsilon.eol.execute.context.Variable;
import org.eclipse.epsilon.eol.staticanalyser.EolStaticAnalyser;
import org.eclipse.epsilon.eol.types.EolPrimitiveType;
import org.eclipse.epsilon.erl.dom.Post;
import org.eclipse.epsilon.erl.dom.Pre;

Expand Down
6 changes: 4 additions & 2 deletions plugins/org.eclipse.epsilon.eol.engine/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Bundle-SymbolicName: org.eclipse.epsilon.eol.engine;singleton:=true
Bundle-Version: 2.6.0.qualifier
Bundle-Vendor: Eclipse Modeling Project
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.epsilon.common;visibility:=reexport,
org.eclipse.epsilon.eol.staticanalyser;bundle-version="2.6.0"
Require-Bundle: org.eclipse.epsilon.common;visibility:=reexport
Export-Package: org.eclipse.epsilon.eol,
org.eclipse.epsilon.eol.concurrent,
org.eclipse.epsilon.eol.debug,
Expand Down Expand Up @@ -39,6 +38,9 @@ Export-Package: org.eclipse.epsilon.eol,
org.eclipse.epsilon.eol.models.java,
org.eclipse.epsilon.eol.models.transactions,
org.eclipse.epsilon.eol.parse,
org.eclipse.epsilon.eol.staticanalyser,
org.eclipse.epsilon.eol.staticanalyser.execute.context,
org.eclipse.epsilon.eol.staticanalyser.types,
org.eclipse.epsilon.eol.tools,
org.eclipse.epsilon.eol.types,
org.eclipse.epsilon.eol.types.concurrent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.Set;
import java.util.stream.Collectors;

import org.eclipse.epsilon.common.dt.editor.AbstractModuleEditor;
import org.eclipse.epsilon.common.module.AbstractModuleElement;
import org.eclipse.epsilon.common.module.IModule;
import org.eclipse.epsilon.common.module.IModuleValidator;
Expand Down Expand Up @@ -127,25 +126,11 @@ public class EolStaticAnalyser implements IModuleValidator, IEolVisitor {
// parameters
HashMap<OperationCallExpression, ArrayList<EolType>> matchedReturnType = new HashMap<>(); // keeping returnTypes of
// matched operations
HashMap<OperationCallExpression, Boolean> matched = new HashMap<>(); // finding one perfect match, in doesn't change
// for every missmatch

public static void main(String[] args) throws Exception {

EolModule module = new EolModule();
module.parse("(1 or true).println();");
IModelFactory modelFactory = new StaticModelFactory();
EolStaticAnalyser analyser = new EolStaticAnalyser(modelFactory);
List<ModuleMarker> markers = analyser.validate(module);
for (ModuleMarker marker : markers) {
System.out.println(marker.getMessage());
}
}
HashMap<OperationCallExpression, Boolean> matched = new HashMap<>(); // finding one perfect match, in doesn't change // for every missmatch

public EolStaticAnalyser() {
this(new StaticModelFactory());
}

public EolStaticAnalyser(IModelFactory modelFactory) {
context.modelFactory = modelFactory;
}
Expand Down Expand Up @@ -1296,7 +1281,7 @@ public List<ModuleMarker> validate(IModule imodule) {

@Override
public String getMarkerType() {
return AbstractModuleEditor.PROBLEM_MARKER;
return ModuleMarker.Severity.Error.name();
}

public void createTypeCompatibilityWarning(Expression requiredExpression, Expression providedExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public List<EolType> getParentTypes() {
if (javaClass == Object.class) {
return Collections.emptyList();
}else {
//TODO Also support Interfaces
return Arrays.asList(new EolNativeType(javaClass.getSuperclass()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -67,7 +67,7 @@ public Set<EolType> getAncestors() {
if (ancestorCache != null) {
return ancestorCache;
}
Set<EolType> ancestors = new HashSet<EolType>();
Set<EolType> ancestors = new LinkedHashSet<EolType>();

Stack<EolType> stack = new Stack<EolType>();
stack.push(this);
Expand Down
7 changes: 0 additions & 7 deletions plugins/org.eclipse.epsilon.eol.staticanalyser/.classpath

This file was deleted.

1 change: 0 additions & 1 deletion plugins/org.eclipse.epsilon.eol.staticanalyser/.gitignore

This file was deleted.

28 changes: 0 additions & 28 deletions plugins/org.eclipse.epsilon.eol.staticanalyser/.project

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions plugins/org.eclipse.epsilon.eol.staticanalyser/plugin.xml

This file was deleted.

12 changes: 0 additions & 12 deletions plugins/org.eclipse.epsilon.eol.staticanalyser/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.eclipse.epsilon.etl.staticanalyser;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.eclipse.epsilon.etl.staticanalyser
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.epsilon.eol.staticanalyser,
Require-Bundle: org.eclipse.epsilon.eol.engine,
org.eclipse.epsilon.etl.engine,
org.eclipse.epsilon.emc.emf,
org.eclipse.epsilon.common.dt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@
import java.util.List;

import org.eclipse.epsilon.common.module.IModule;
import org.eclipse.epsilon.common.module.IModuleValidator;
import org.eclipse.epsilon.common.module.ModuleMarker;
import org.eclipse.epsilon.eol.dom.ExecutableBlock;
import org.eclipse.epsilon.eol.dom.Expression;
import org.eclipse.epsilon.eol.dom.StatementBlock;
import org.eclipse.epsilon.eol.execute.context.FrameType;
import org.eclipse.epsilon.eol.execute.context.Variable;
import org.eclipse.epsilon.eol.staticanalyser.execute.context.Variable;
import org.eclipse.epsilon.eol.staticanalyser.EolStaticAnalyser;
import org.eclipse.epsilon.eol.types.EolPrimitiveType;
import org.eclipse.epsilon.eol.staticanalyser.types.EolPrimitiveType;
import org.eclipse.epsilon.erl.dom.Post;
import org.eclipse.epsilon.erl.dom.Pre;
import org.eclipse.epsilon.etl.EtlModule;
import org.eclipse.epsilon.etl.IEtlModule;
import org.eclipse.epsilon.etl.dom.IEtlVisitor;
import org.eclipse.epsilon.etl.dom.TransformationRule;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import org.eclipse.epsilon.common.module.IModule;
import org.eclipse.epsilon.common.module.ModuleMarker;
import org.eclipse.epsilon.eol.execute.context.Variable;
import org.eclipse.epsilon.eol.staticanalyser.execute.context.Variable;
import org.eclipse.epsilon.eol.staticanalyser.EolStaticAnalyser;
import org.eclipse.epsilon.erl.dom.Post;
import org.eclipse.epsilon.erl.dom.Pre;
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.eclipse.epsilon.examples.staticanalyser
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.epsilon.eol.engine,
org.eclipse.epsilon.eol.staticanalyser,
org.eclipse.epsilon.emc.emf,
org.eclipse.epsilon.etl.staticanalyser,
org.eclipse.epsilon.etl.engine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.eclipse.epsilon.ecl.launch.EclRunConfiguration;
import org.eclipse.epsilon.ecl.staticanalyser.EclStaticAnalyser;
import org.eclipse.epsilon.eol.IEolModule;
import org.eclipse.epsilon.eol.staticanalyser.SubEmfModelFactory;
import org.eclipse.epsilon.examples.staticanalyser.eol.SubEmfModelFactory;

public class EclPreExecuteConfiguration extends EclRunConfiguration {
IEolModule module;
Expand Down
1 change: 0 additions & 1 deletion plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
<module>org.eclipse.epsilon.eol.dt.interpreter</module>
<module>org.eclipse.epsilon.eol.dap</module>
<module>org.eclipse.epsilon.eol.engine</module>
<module>org.eclipse.epsilon.eol.staticanalyser</module>
<module>org.eclipse.epsilon.eol.tools</module>
<module>org.eclipse.epsilon.epl.dt</module>
<module>org.eclipse.epsilon.epl.engine</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ Export-Package: org.eclipse.epsilon.eol.staticanalyser.tests
Automatic-Module-Name: org.eclipse.epsilon.eol.staticanalyser.tests
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.epsilon.eol.engine,
org.eclipse.epsilon.eol.staticanalyser,
org.junit,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi;bundle-version="2.16.0"
org.eclipse.epsilon.emc.emf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.eclipse.epsilon.common.module.ModuleMarker.Severity;
import org.eclipse.epsilon.eol.EolModule;
import org.eclipse.epsilon.eol.staticanalyser.EolStaticAnalyser;
import org.eclipse.epsilon.eol.staticanalyser.StaticModelFactory;
import org.eclipse.epsilon.eol.staticanalyser.types.EolType;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.eclipse.epsilon.common.module.ModuleMarker;
import org.eclipse.epsilon.eol.EolModule;
import org.eclipse.epsilon.eol.staticanalyser.EolStaticAnalyser;
import org.eclipse.epsilon.eol.staticanalyser.StaticModelFactory;
import org.eclipse.epsilon.eol.types.EolType;
import org.junit.BeforeClass;
import org.junit.Ignore;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.eclipse.epsilon.eol.staticanalyser;
package org.eclipse.epsilon.eol.staticanalyser.tests;

import org.eclipse.epsilon.emc.emf.EmfModel;
import org.eclipse.epsilon.eol.models.IModel;
import org.eclipse.epsilon.eol.staticanalyser.IModelFactory;

public class StaticModelFactory implements IModelFactory {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*Native<java.lang.Number>*/1.abs();
/*Integer*/1.ceiling();
/*Integer*/1.floor();
/*Real*/1.log();
/*Real*/1.log10();
/*Native<java.lang.Number>*/1.max(2);
/*Native<java.lang.Number>*/1.min(2);
/*Native<java.lang.Number>*/1.pow(2);
/*Integer*/1.round();

/*Sequence<Integer>*/1.iota(10, 1);
/*Integer*/1.mod(2);
/*Sequence<Integer>*/1.to(10);
/*String*/1.toBinary();
/*String*/1.toHex();

0 comments on commit ca71017

Please sign in to comment.