From 99cd65dc59649d14c66ca327f7ba75dc2d6ac5ba Mon Sep 17 00:00:00 2001 From: Peter Joergensen Date: Tue, 3 Mar 2015 09:59:39 +0100 Subject: [PATCH 001/706] First pass at cleaning up the completion related code --- .../overture/ide/ui/templates/SearchType.java | 5 --- .../ui/templates/VdmCompleteProcesser.java | 42 ++++++++----------- .../ui/templates/VdmCompletionContext.java | 25 ++++------- 3 files changed, 25 insertions(+), 47 deletions(-) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/SearchType.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/SearchType.java index abeadc9386..d314c826af 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/SearchType.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/SearchType.java @@ -4,14 +4,9 @@ public enum SearchType { // Proposal, Field, Unknown, Type Quote, - New, - Mk, - CallParam, - Dot, - Types, }; \ No newline at end of file diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java index e763926234..112688aa60 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java @@ -104,13 +104,11 @@ public void computeCompletionProposals(VdmCompletionContext info, if (proposal instanceof CompletionProposal) { CompletionProposal cp = (CompletionProposal) proposal; - if (replacementDisplayString.contains(cp.getDisplayString()) - // || !cp.getDisplayString().toLowerCase().replace('<', - // ' ').trim().startsWith(info.prefix.toString().toLowerCase()) - ) + if (replacementDisplayString.contains(cp.getDisplayString())) { continue; } + replacementDisplayString.add(cp.getDisplayString()); } proposals.add(proposal); @@ -175,7 +173,6 @@ && new PAccessSpecifierAssistant(null).isPublic(node.getAccess())) }); } catch (AnalysisException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -275,28 +272,25 @@ public void caseAQuoteType(AQuoteType node) void populateQuotes(INode node, String baseValue, String name) { - // if (!info2.prefix.toString().equals(baseValue)) - { - IContextInformation info = new ContextInformation(name, name); //$NON-NLS-1$ + IContextInformation info = new ContextInformation(name, name); //$NON-NLS-1$ - int curOffset = offset + info2.offset;// - info2.proposalPrefix.length(); - int length = name.length(); - int replacementLength = info2.proposalPrefix.length(); + int curOffset = offset + info2.offset;// - info2.proposalPrefix.length(); + int length = name.length(); + int replacementLength = info2.proposalPrefix.length(); - if (info2.proposalPrefix.toString().equals("<" - + baseValue + ">")) - { - // replacementLength+=1; - // length+=1; - curOffset = offset; - replacementLength = 0; - } + if (info2.proposalPrefix.toString().equals("<" + baseValue + + ">")) + { + // replacementLength+=1; + // length+=1; + curOffset = offset; + replacementLength = 0; + } - if (("<" + baseValue).toLowerCase().startsWith(info2.proposalPrefix.toString().toLowerCase())) - { - proposals.add(new CompletionProposal(name, curOffset, replacementLength, length, imgProvider.getImageLabel(node, 0), name, info, name)); - } + if (("<" + baseValue).toLowerCase().startsWith(info2.proposalPrefix.toString().toLowerCase())) + { + proposals.add(new CompletionProposal(name, curOffset, replacementLength, length, imgProvider.getImageLabel(node, 0), name, info, name)); } } }); @@ -312,8 +306,6 @@ public void completeFields(VdmCompletionContext info, VdmDocument document, { try { - List ast = getAst(document); - INode found = new AstLocationSearcher2().getNode(new TextReference(document.getSourceUnit().getSystemFile(), offset), getLocalFileAst(document)); if (found != null) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java index 2b56763551..0e1bb3c268 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java @@ -34,7 +34,6 @@ public VdmCompletionContext(StringBuffer rawScan) private void init() { calcSearchType(); - System.out.println("Computed completion context: "+toString()); } @@ -75,14 +74,7 @@ private void calcSearchType() } } - @Override - public String toString() - { - return type + " - Root: '" + getQualifiedSource() + "' Proposal: '" - + proposalPrefix+"'" +" offset: "+offset; - } - - String getQualifiedSource() + private String getQualifiedSource() { String res = ""; if (root != null && !root.isEmpty()) @@ -96,12 +88,11 @@ String getQualifiedSource() } return res; } - - // @Override - // public String toString() - // { - // return "Type: \"" + fieldType + "\" " + (afterMk ? "mk_" : "") - // + (afterNew ? "new " : "") + "\"" - // + (field.length() != 0 ? field + "." : "") + proposal + "\""; - // } + + @Override + public String toString() + { + return type + " - Root: '" + getQualifiedSource() + "' Proposal: '" + + proposalPrefix+"'" +" offset: "+offset; + } } \ No newline at end of file From 15c2fae3a3a5b9ee2984dc0d045fd8a379ef24ef Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 3 Mar 2015 10:29:19 +0100 Subject: [PATCH 002/706] Move tests/ to ui.tests. [Issue: #422] --- ide/tests/pom.xml | 23 ------------------- .../ui => ui.tests}/META-INF/MANIFEST.MF | 4 ++-- ide/{tests/ui => ui.tests}/README.md | 0 ide/{tests/ui => ui.tests}/build.properties | 0 ide/{tests/ui => ui.tests}/pom.xml | 10 ++++---- .../overture/ide/ui/MultipartScannerTest.java | 0 .../org/overture/ide/ui/VdmPpKeywords.java | 0 7 files changed, 7 insertions(+), 30 deletions(-) delete mode 100644 ide/tests/pom.xml rename ide/{tests/ui => ui.tests}/META-INF/MANIFEST.MF (76%) rename ide/{tests/ui => ui.tests}/README.md (100%) rename ide/{tests/ui => ui.tests}/build.properties (100%) rename ide/{tests/ui => ui.tests}/pom.xml (80%) rename ide/{tests/ui => ui.tests}/src/main/java/org/overture/ide/ui/MultipartScannerTest.java (100%) rename ide/{tests/ui => ui.tests}/src/main/java/org/overture/ide/ui/VdmPpKeywords.java (100%) diff --git a/ide/tests/pom.xml b/ide/tests/pom.xml deleted file mode 100644 index 04faaf3abf..0000000000 --- a/ide/tests/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - - - org.overturetool - ide - 2.2.3-SNAPSHOT - ../pom.xml - - - pom - - org.overturetool.ide - org.overture.ide.tests - Overture IDE tests - Providing tests for the Overture IDE - - - ui - - - diff --git a/ide/tests/ui/META-INF/MANIFEST.MF b/ide/ui.tests/META-INF/MANIFEST.MF similarity index 76% rename from ide/tests/ui/META-INF/MANIFEST.MF rename to ide/ui.tests/META-INF/MANIFEST.MF index 488bac8ed7..43bea04a0d 100644 --- a/ide/tests/ui/META-INF/MANIFEST.MF +++ b/ide/ui.tests/META-INF/MANIFEST.MF @@ -4,9 +4,9 @@ Bundle-ActivationPolicy: lazy Bundle-Version: 2.2.3.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin -Bundle-Name: org.overture.ide.tests.ui +Bundle-Name: org.overture.ide.ui.tests Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.overture.ide.tests.ui;singleton:=true +Bundle-SymbolicName: org.overture.ide.ui.tests;singleton:=true Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Fragment-Host: org.overture.ide.ui Import-Package: org.junit diff --git a/ide/tests/ui/README.md b/ide/ui.tests/README.md similarity index 100% rename from ide/tests/ui/README.md rename to ide/ui.tests/README.md diff --git a/ide/tests/ui/build.properties b/ide/ui.tests/build.properties similarity index 100% rename from ide/tests/ui/build.properties rename to ide/ui.tests/build.properties diff --git a/ide/tests/ui/pom.xml b/ide/ui.tests/pom.xml similarity index 80% rename from ide/tests/ui/pom.xml rename to ide/ui.tests/pom.xml index 6e5bf8b5a4..ef4573a126 100644 --- a/ide/tests/ui/pom.xml +++ b/ide/ui.tests/pom.xml @@ -3,17 +3,17 @@ 4.0.0 - org.overturetool.ide - org.overture.ide.tests + org.overturetool + ide 2.2.3-SNAPSHOT ../pom.xml eclipse-test-plugin - org.overturetool.ide.tests - org.overture.ide.tests.ui - org.overture.ide.tests.ui + org.overturetool.ide + org.overture.ide.ui.tests + Overture UI Tests src/main/java diff --git a/ide/tests/ui/src/main/java/org/overture/ide/ui/MultipartScannerTest.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/MultipartScannerTest.java similarity index 100% rename from ide/tests/ui/src/main/java/org/overture/ide/ui/MultipartScannerTest.java rename to ide/ui.tests/src/main/java/org/overture/ide/ui/MultipartScannerTest.java diff --git a/ide/tests/ui/src/main/java/org/overture/ide/ui/VdmPpKeywords.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/VdmPpKeywords.java similarity index 100% rename from ide/tests/ui/src/main/java/org/overture/ide/ui/VdmPpKeywords.java rename to ide/ui.tests/src/main/java/org/overture/ide/ui/VdmPpKeywords.java From 42b59bac485e0021ccd8fe04dc6df9dd38d308f1 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 3 Mar 2015 10:31:44 +0100 Subject: [PATCH 003/706] Update ide pom to run UI tests via profile. [Issue: #422] --- ide/pom.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ide/pom.xml b/ide/pom.xml index 61fe2f3944..a2a726670b 100644 --- a/ide/pom.xml +++ b/ide/pom.xml @@ -34,7 +34,6 @@ platform features product - tests @@ -372,6 +371,18 @@ the manifests, though. + + + + + ui-tests + + false + + + ui.tests + + From 8b77c91e83751a844452172de857e74854bae39c Mon Sep 17 00:00:00 2001 From: Peter Joergensen Date: Tue, 3 Mar 2015 11:15:58 +0100 Subject: [PATCH 004/706] Improved code and added some documentation for the 'VdmCompletionContext' --- .../ui/templates/VdmCompletionContext.java | 75 +++++++++++++------ 1 file changed, 53 insertions(+), 22 deletions(-) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java index 0e1bb3c268..5232b6a594 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java @@ -18,8 +18,13 @@ public class VdmCompletionContext // new private StringBuffer rawScan; private StringBuffer processedScan; + + /** + * Index where replacement must start. For example, if the + * rawScan is ' + consQuoteContext(index); return; } index = rawScan.toString().indexOf("new"); + // New must appear at the first index of the raw scan if (index == 0) { - // quote - processedScan = new StringBuffer(rawScan.subSequence(index - + "new".length(), rawScan.length())); - proposalPrefix = processedScan.toString().trim(); + // Completion of constructors + consConstructorCallContext(); + return; + } + } + + /** + * Constructs the completion context for a constructor call + * + * @param index + */ + private void consConstructorCallContext() + { + // The processed scan contains what + final int NEW_LENGTH = "new".length(); + + // This gives us everything after new, e.g. ' MyClass' if you type 'new MyClass' + CharSequence subSeq = rawScan.subSequence(NEW_LENGTH, rawScan.length()); + + processedScan = new StringBuffer(subSeq); + proposalPrefix = processedScan.toString().trim(); - for (int i = index + "new".length(); i < rawScan.length(); i++) + for (int i = NEW_LENGTH; i < rawScan.length(); i++) + { + if (Character.isJavaIdentifierStart(rawScan.charAt(i))) { - if (Character.isJavaIdentifierStart(rawScan.charAt(i))) - { - offset = -(rawScan.length() - i); - break; - } + offset = -(rawScan.length() - i); + break; } - - type = SearchType.New; - return; } + + type = SearchType.New; + } + +/** + * Constructs the completion context for quotes + * + * @param index The index of the '<' character + */ + private void consQuoteContext(int index) + { + processedScan = new StringBuffer(rawScan.subSequence(index, rawScan.length())); + proposalPrefix = processedScan.toString(); + offset = -(rawScan.length() - index); + type = SearchType.Quote; } private String getQualifiedSource() @@ -88,11 +119,11 @@ private String getQualifiedSource() } return res; } - + @Override public String toString() { return type + " - Root: '" + getQualifiedSource() + "' Proposal: '" - + proposalPrefix+"'" +" offset: "+offset; + + proposalPrefix + "'" + " offset: " + offset; } } \ No newline at end of file From afe3f9b9a9e7a91358e619a120ce6ee9baeb5a02 Mon Sep 17 00:00:00 2001 From: Peter Joergensen Date: Tue, 3 Mar 2015 11:17:32 +0100 Subject: [PATCH 005/706] Moved the code that constructs the 'VdmCompletionContext' into a utility class and made it easier accessible --- .../ide/ui/completion/CompletionUtil.java | 72 +++++++++++++++++++ .../templates/VdmContentAssistProcessor.java | 63 +--------------- 2 files changed, 74 insertions(+), 61 deletions(-) create mode 100644 ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java diff --git a/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java b/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java new file mode 100644 index 0000000000..c29ce7784b --- /dev/null +++ b/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java @@ -0,0 +1,72 @@ +package org.overture.ide.ui.completion; + +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.overture.ast.lex.VDMToken; +import org.overture.ide.ui.VdmUIPlugin; +import org.overture.ide.ui.templates.VdmCompletionContext; + +public class CompletionUtil +{ + private static VDMToken getToken(char c) + { + String name = "" + c; + for (VDMToken token : VDMToken.values()) + { + if (token.toString() != null && token.toString().equals(name)) + { + return token; + } + } + return null; + } + + public static VdmCompletionContext computeVdmCompletionContext(IDocument doc, + int documentOffset) + { + // Use string buffer to collect characters + StringBuffer scanned = new StringBuffer(); + while (true) + { + try + { + if(documentOffset-1==-1) + { + //EOF + break; + } + // Read character backwards + char c = doc.getChar(--documentOffset); + + VDMToken token = null; + + // We stop if it is a VDM token unless it is a '<', a '.' or a '(' + if ((token = getToken(c)) != null)// '`' == null + { + if (!(token == VDMToken.LT /* < */ || token == VDMToken.POINT/* . */|| token == VDMToken.BRA /* ( */)) + { + break; + } + } + + scanned.append(c); + + if(c=='n' && scanned.length()>3&& scanned.substring(scanned.length()-4, scanned.length()).matches("\\swen")) + { + + break; + } + + + } catch (BadLocationException e) + { + e.printStackTrace(); + VdmUIPlugin.log("completion failed", e); + // Document start reached, no tag found + break; + } + } + return new VdmCompletionContext(scanned.reverse()); + + } +} diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java index 6f748a1159..f31cffaba6 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java @@ -30,6 +30,7 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.overture.ast.lex.VDMToken; import org.overture.ide.ui.VdmUIPlugin; +import org.overture.ide.ui.completion.CompletionUtil; import org.overture.ide.ui.editor.core.VdmDocument; import org.overture.ide.ui.internal.viewsupport.VdmElementImageProvider; @@ -72,7 +73,7 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, if (viewer.getDocument() instanceof VdmDocument) { - processer.computeCompletionProposals(computeVdmCompletionContext(viewer.getDocument(), offset), (VdmDocument) viewer.getDocument(), modList, offset); + processer.computeCompletionProposals(CompletionUtil.computeVdmCompletionContext(viewer.getDocument(), offset), (VdmDocument) viewer.getDocument(), modList, offset); } if (modList.size() > 0) @@ -82,64 +83,4 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, return completionProposals; } - - VDMToken getToken(char c) - { - String name = "" + c; - for (VDMToken token : VDMToken.values()) - { - if (token.toString() != null && token.toString().equals(name)) - { - return token; - } - } - return null; - } - - private VdmCompletionContext computeVdmCompletionContext(IDocument doc, - int documentOffset) - { - // Use string buffer to collect characters - StringBuffer scanned = new StringBuffer(); - while (true) - { - try - { - if(documentOffset-1==-1) - { - //EOF - break; - } - // Read character backwards - char c = doc.getChar(--documentOffset); - - VDMToken token = null; - if ((token = getToken(c)) != null)// '`' == null - { - if (!(token == VDMToken.LT || token == VDMToken.POINT/* . */|| token == VDMToken.BRA /* ( */)) - { - break; - } - } - - scanned.append(c); - - if(c=='n' && scanned.length()>3&& scanned.substring(scanned.length()-4, scanned.length()).matches("\\swen")) - { - - break; - } - - - } catch (BadLocationException e) - { - e.printStackTrace(); - VdmUIPlugin.log("completion failed", e); - // Document start reached, no tag found - break; - } - } - return new VdmCompletionContext(scanned.reverse()); - - } } From 7ced24ddb2eb446c6af1d7693c06704a28d22f56 Mon Sep 17 00:00:00 2001 From: Peter Joergensen Date: Tue, 3 Mar 2015 11:18:12 +0100 Subject: [PATCH 006/706] Changed access modifier to private --- .../org/overture/ide/ui/templates/VdmCompleteProcesser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java index 112688aa60..8eec99b7b1 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java @@ -61,7 +61,7 @@ public class VdmCompleteProcesser { - VdmElementImageProvider imgProvider = new VdmElementImageProvider(); + private VdmElementImageProvider imgProvider = new VdmElementImageProvider(); public void computeCompletionProposals(VdmCompletionContext info, VdmDocument document, List proposals, From f3b30ad0da4201e0fce154128d3a34a0d6b8c72c Mon Sep 17 00:00:00 2001 From: Peter Joergensen Date: Tue, 3 Mar 2015 11:19:25 +0100 Subject: [PATCH 007/706] Added first UI test to exercise construction of the 'VdmCompletionVontext' --- .../org/overture/ide/ui/CompletionTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ide/tests/ui/src/main/java/org/overture/ide/ui/CompletionTest.java diff --git a/ide/tests/ui/src/main/java/org/overture/ide/ui/CompletionTest.java b/ide/tests/ui/src/main/java/org/overture/ide/ui/CompletionTest.java new file mode 100644 index 0000000000..2c2a4d4656 --- /dev/null +++ b/ide/tests/ui/src/main/java/org/overture/ide/ui/CompletionTest.java @@ -0,0 +1,36 @@ +package org.overture.ide.ui; + +import org.eclipse.jface.text.Document; +import org.junit.Assert; +import org.junit.Test; +import org.overture.ide.ui.completion.CompletionUtil; +import org.overture.ide.ui.templates.SearchType; +import org.overture.ide.ui.templates.VdmCompletionContext; + +public class CompletionTest +{ + @Test + public void testScanQuote() + { + String docContent = "let a Date: Tue, 3 Mar 2015 11:22:51 +0100 Subject: [PATCH 008/706] Cleaning up the content assist processor --- .../ide/ui/templates/VdmContentAssistProcessor.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java index f31cffaba6..cb47170943 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java @@ -24,22 +24,15 @@ import java.util.ArrayList; import java.util.List; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.overture.ast.lex.VDMToken; -import org.overture.ide.ui.VdmUIPlugin; import org.overture.ide.ui.completion.CompletionUtil; import org.overture.ide.ui.editor.core.VdmDocument; -import org.overture.ide.ui.internal.viewsupport.VdmElementImageProvider; public abstract class VdmContentAssistProcessor extends VdmTemplateAssistProcessor { - - VdmElementImageProvider imgProvider = new VdmElementImageProvider(); - VdmCompleteProcesser processer = new VdmCompleteProcesser(); + private VdmCompleteProcesser processer = new VdmCompleteProcesser(); public boolean enableTemplate() { From 00af41e6a7590ca8bf12d565eec3f5e2cf057416 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 3 Mar 2015 12:05:46 +0100 Subject: [PATCH 009/706] Move completion test to correct location. [Issue: #422] --- .../src/main/java/org/overture/ide/ui/CompletionTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ide/{tests/ui => ui.tests}/src/main/java/org/overture/ide/ui/CompletionTest.java (100%) diff --git a/ide/tests/ui/src/main/java/org/overture/ide/ui/CompletionTest.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionTest.java similarity index 100% rename from ide/tests/ui/src/main/java/org/overture/ide/ui/CompletionTest.java rename to ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionTest.java From 246d8550271bd9657f7b365d8fe50b2e7eca71e4 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 3 Mar 2015 13:10:51 +0100 Subject: [PATCH 010/706] Initial tests for constructor auto-completion. [Issue: #423] --- .../org/overture/ide/ui/CompletionTest.java | 67 ++++++++++++++++++- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionTest.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionTest.java index 2c2a4d4656..52c05f13b9 100644 --- a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionTest.java +++ b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionTest.java @@ -9,6 +9,10 @@ public class CompletionTest { + private static final String SEARCH_TYPE_ERROR_MSG = "Incorrect search type"; + private static final String PROPOSAL_PREFIX_ERROR_MSG = "Incorrect proposal prefix"; + private static final String OFFSET_ERROR_MSG = "Incorrect offset"; + @Test public void testScanQuote() { @@ -18,14 +22,71 @@ public void testScanQuote() VdmCompletionContext ctxt = consVdmCompletionCtxt(docContent, documentOffset); // Search for quotes - Assert.assertEquals(SearchType.Quote,ctxt.type); + Assert.assertEquals(SEARCH_TYPE_ERROR_MSG, SearchType.Quote,ctxt.type); // The prefix of the proposal - Assert.assertEquals(" Date: Tue, 3 Mar 2015 13:53:48 +0100 Subject: [PATCH 011/706] Rename completion test to sth more accurate. --- .../ide/ui/{CompletionTest.java => CompletionContextTest.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ide/ui.tests/src/main/java/org/overture/ide/ui/{CompletionTest.java => CompletionContextTest.java} (100%) diff --git a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionTest.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java similarity index 100% rename from ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionTest.java rename to ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java From c021e579106364209429f68cc7ccfbe20a738050 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 3 Mar 2015 13:54:25 +0100 Subject: [PATCH 012/706] Privatize completion context fields. Also delete the offset field since it's derived from the prefix. --- .../ide/ui/CompletionContextTest.java | 121 ++++++++---------- .../ui/templates/VdmCompleteProcesser.java | 28 ++-- .../ui/templates/VdmCompletionContext.java | 76 ++++++----- 3 files changed, 113 insertions(+), 112 deletions(-) diff --git a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java index 52c05f13b9..a3744abd3f 100644 --- a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java +++ b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java @@ -7,88 +7,77 @@ import org.overture.ide.ui.templates.SearchType; import org.overture.ide.ui.templates.VdmCompletionContext; -public class CompletionTest +public class CompletionContextTest { private static final String SEARCH_TYPE_ERROR_MSG = "Incorrect search type"; private static final String PROPOSAL_PREFIX_ERROR_MSG = "Incorrect proposal prefix"; private static final String OFFSET_ERROR_MSG = "Incorrect offset"; @Test - public void testScanQuote() + public void testDot_Field() { - String docContent = "let a ")) { // replacementLength+=1; @@ -288,7 +288,7 @@ void populateQuotes(INode node, String baseValue, String name) replacementLength = 0; } - if (("<" + baseValue).toLowerCase().startsWith(info2.proposalPrefix.toString().toLowerCase())) + if (("<" + baseValue).toLowerCase().startsWith(info2.getProposalPrefix().toLowerCase())) { proposals.add(new CompletionProposal(name, curOffset, replacementLength, length, imgProvider.getImageLabel(node, 0), name, info, name)); } @@ -325,7 +325,7 @@ public void completeFields(VdmCompletionContext info, VdmDocument document, for (AFieldField field : rt.getFields()) { - if (field.getTag().toLowerCase().startsWith(info.proposalPrefix.toString().toLowerCase())) + if (field.getTag().toLowerCase().startsWith(info.getProposalPrefix().toLowerCase())) { proposals.add(createProposal(field, offset, info)); } @@ -442,7 +442,7 @@ private ICompletionProposal createProposal(INode node, int offset, } IContextInformation info2 = new ContextInformation(name, name); //$NON-NLS-1$ return new CompletionProposal(name, offset - - info.proposalPrefix.length(), info.proposalPrefix.length(), name.length(), imgProvider.getImageLabel(node, 0), name, info2, node.toString()); + - info.getProposalPrefix().length(), info.getProposalPrefix().length(), name.length(), imgProvider.getImageLabel(node, 0), name, info2, node.toString()); } private INode getType(String typeName, List ast) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java index 5232b6a594..62b4d2afea 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java @@ -6,29 +6,18 @@ public class VdmCompletionContext { - // boolean isEmpty = false; - // // SearchType type = SearchType.Proposal; - // StringBuffer proposal = new StringBuffer(); - // StringBuffer field = new StringBuffer(); - // StringBuffer fieldType = new StringBuffer(); - // boolean afterNew = false; - // boolean afterMk = false; - // public StringBuffer prefix = new StringBuffer(); - - // new private StringBuffer rawScan; private StringBuffer processedScan; - /** +/** * Index where replacement must start. For example, if the * rawScan is ' root = new Vector(); + private List root = new Vector(); public VdmCompletionContext(StringBuffer rawScan) { @@ -37,12 +26,6 @@ public VdmCompletionContext(StringBuffer rawScan) } private void init() - { - calcSearchType(); - System.out.println("Computed completion context: " + toString()); - } - - private void calcSearchType() { int index = rawScan.toString().lastIndexOf("<"); @@ -62,6 +45,25 @@ private void calcSearchType() consConstructorCallContext(); return; } + + // Completion for foo.bar. This covers things such as instance variables, + // values, a record, a tuple, operations and functions + + String[] split = rawScan.toString().split("\\."); + if (split.length == 2) + { // only works for one . atm + consDotContext(split); + return; + } + } + + private void consDotContext(String[] split) + { + this.type = SearchType.Dot; + this.proposalPrefix = split[1]; + + this.root = new Vector<>(); + root.add(split[0]); } /** @@ -80,15 +82,6 @@ private void consConstructorCallContext() processedScan = new StringBuffer(subSeq); proposalPrefix = processedScan.toString().trim(); - for (int i = NEW_LENGTH; i < rawScan.length(); i++) - { - if (Character.isJavaIdentifierStart(rawScan.charAt(i))) - { - offset = -(rawScan.length() - i); - break; - } - } - type = SearchType.New; } @@ -101,7 +94,6 @@ private void consQuoteContext(int index) { processedScan = new StringBuffer(rawScan.subSequence(index, rawScan.length())); proposalPrefix = processedScan.toString(); - offset = -(rawScan.length() - index); type = SearchType.Quote; } @@ -120,10 +112,30 @@ private String getQualifiedSource() return res; } + public int getReplacementOffset() + { + return -proposalPrefix.length(); + } + + public SearchType getType() + { + return type; + } + + public String getProposalPrefix() + { + return proposalPrefix; + } + + public List getRoot() + { + return root; + } + @Override public String toString() { return type + " - Root: '" + getQualifiedSource() + "' Proposal: '" - + proposalPrefix + "'" + " offset: " + offset; + + proposalPrefix + "'" + " offset: "; } } \ No newline at end of file From 3e48e3cce5a416d18ea072830efb0b8943384446 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 3 Mar 2015 13:55:08 +0100 Subject: [PATCH 013/706] Pedantic spellchecking. --- .../{VdmCompleteProcesser.java => VdmCompleteProcessor.java} | 2 +- .../overture/ide/ui/templates/VdmContentAssistProcessor.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename ide/ui/src/main/java/org/overture/ide/ui/templates/{VdmCompleteProcesser.java => VdmCompleteProcessor.java} (99%) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java similarity index 99% rename from ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java rename to ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java index 857c13f9d5..e0bfd20e33 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcesser.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java @@ -59,7 +59,7 @@ import org.overture.ide.ui.utility.ast.AstLocationSearcher2.TextReference; import org.overture.ide.ui.utility.ast.AstNameUtil; -public class VdmCompleteProcesser +public class VdmCompleteProcessor { private VdmElementImageProvider imgProvider = new VdmElementImageProvider(); diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java index cb47170943..6bcc122544 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmContentAssistProcessor.java @@ -32,7 +32,7 @@ public abstract class VdmContentAssistProcessor extends VdmTemplateAssistProcessor { - private VdmCompleteProcesser processer = new VdmCompleteProcesser(); + private VdmCompleteProcessor processer = new VdmCompleteProcessor(); public boolean enableTemplate() { From 32c3b6f61e9fe95fd57a69eead1cc2b077278b21 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 3 Mar 2015 13:57:16 +0100 Subject: [PATCH 014/706] Remove a LOT of unused code. --- .../ui/templates/VdmCompleteProcessor.java | 220 +----------------- 1 file changed, 4 insertions(+), 216 deletions(-) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java index e0bfd20e33..e16f9c958e 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java @@ -32,14 +32,8 @@ import org.overture.ast.analysis.AnalysisException; import org.overture.ast.analysis.DepthFirstAnalysisAdaptor; import org.overture.ast.assistant.definition.PAccessSpecifierAssistant; -import org.overture.ast.definitions.AExplicitFunctionDefinition; import org.overture.ast.definitions.AExplicitOperationDefinition; -import org.overture.ast.definitions.AImplicitFunctionDefinition; -import org.overture.ast.definitions.AImplicitOperationDefinition; -import org.overture.ast.definitions.AInstanceVariableDefinition; -import org.overture.ast.definitions.ALocalDefinition; import org.overture.ast.definitions.ATypeDefinition; -import org.overture.ast.definitions.AValueDefinition; import org.overture.ast.definitions.PDefinition; import org.overture.ast.definitions.SClassDefinition; import org.overture.ast.expressions.AQuoteLiteralExp; @@ -68,13 +62,6 @@ public void computeCompletionProposals(VdmCompletionContext info, int offset) { List calculatedProposals = new Vector(); - // if (info.afterNew || info.afterMk || info.isEmpty) - // { - // completeTypes(info, document, calculatedProposals, offset); - // } else - // { - // completeFields(info, document, calculatedProposals, offset); - // completeFields(info, document, calculatedProposals, offset); switch (info.getType()) { @@ -108,7 +95,7 @@ public void computeCompletionProposals(VdmCompletionContext info, { continue; } - + replacementDisplayString.add(cp.getDisplayString()); } proposals.add(proposal); @@ -181,16 +168,13 @@ && new PAccessSpecifierAssistant(null).isPublic(node.getAccess())) public void completeTypes(VdmCompletionContext info, VdmDocument document, List proposals, int offset) { - // boolean modulesOnly = info.afterNew || info.isEmpty; - // boolean recordTypesOnly = info.afterMk || info.isEmpty; - // String typeName = info.field.toString(); - for (INode element : getAst(document)) { if (info.getType() == SearchType.Types) { String name = AstNameUtil.getName(element); - if (name.startsWith(info.getProposalPrefix()) || name.length() == 0) + if (name.startsWith(info.getProposalPrefix()) + || name.length() == 0) { IContextInformation ctxtInfo = new ContextInformation(name, name); //$NON-NLS-1$ proposals.add(new CompletionProposal(name, offset, 0, name.length(), imgProvider.getImageLabel(element, 0), name, ctxtInfo, name)); @@ -279,11 +263,8 @@ void populateQuotes(INode node, String baseValue, String name) int length = name.length(); int replacementLength = info2.getProposalPrefix().length(); - if (info2.getProposalPrefix().equals("<" + baseValue - + ">")) + if (info2.getProposalPrefix().equals("<" + baseValue + ">")) { - // replacementLength+=1; - // length+=1; curOffset = offset; replacementLength = 0; } @@ -331,33 +312,6 @@ public void completeFields(VdmCompletionContext info, VdmDocument document, } } } - } else - { - // FIXME old code - - // if (info.fieldType.toString().trim().length() != 0) - // { - // completeFromType(info.fieldType.toString(), info.proposalPrefix.toString(), proposals, offset, ast); - // } else - // { - // List possibleMatch = new Vector(); - // for (INode node : getLocalFileAst(document)) - // { - // for (INode field : getFields(node)) - // { - // if (AstNameUtil.getName(field).equals(info.field.toString())) - // { - // // Ok match then complete it - // completeFromType(getTypeName(field), info.proposalPrefix.toString(), proposals, offset, ast); - // } else if (AstNameUtil.getName(field).startsWith(info.field.toString())) - // { - // possibleMatch.add(field); - // } - // - // } - // - // } - // } } } catch (Exception e) { @@ -365,72 +319,6 @@ public void completeFields(VdmCompletionContext info, VdmDocument document, } } - private String getTypeName(INode field) - { - if (field instanceof AInstanceVariableDefinition) - { - return ((AInstanceVariableDefinition) field).getType().toString(); - } - return ""; - } - - private void completeFromType(String typeName, String proposal, - List proposals, int offset, List ast) - { - // System.out.println("Complete for type: " + typeName - // + " with proposal: " + proposal); - INode type = getType(typeName, ast); - - // Fields - for (INode field : getFields(type)) - { - if (AstNameUtil.getName(field).startsWith(proposal) - || proposal.isEmpty()) - { - proposals.add(createProposal(field, offset)); - } - } - // Operations - for (INode op : getOperations(type)) - { - if (AstNameUtil.getName(op).startsWith(proposal) - || proposal.isEmpty()) - { - proposals.add(createProposal(op, offset)); - } - } - // Functions - for (INode fn : getFunctions(type)) - { - if (AstNameUtil.getName(fn).startsWith(proposal) - || proposal.isEmpty()) - { - proposals.add(createProposal(fn, offset)); - } - } - // Types - for (INode tp : getTypes(type)) - { - if (AstNameUtil.getName(tp).startsWith(proposal) - || proposal.isEmpty()) - { - proposals.add(createProposal(tp, offset)); - } - } - } - - private ICompletionProposal createProposal(INode node, int offset) - { - String name = AstNameUtil.getName(node); - if (node instanceof ATypeDefinition) - { - name = ((ATypeDefinition) node).getLocation().getModule() + "`" - + name; - } - IContextInformation info = new ContextInformation(name, name); //$NON-NLS-1$ - return new CompletionProposal(name, offset, 0, name.length(), imgProvider.getImageLabel(node, 0), name, info, name); - } - private ICompletionProposal createProposal(INode node, int offset, VdmCompletionContext info) { @@ -445,106 +333,6 @@ private ICompletionProposal createProposal(INode node, int offset, - info.getProposalPrefix().length(), info.getProposalPrefix().length(), name.length(), imgProvider.getImageLabel(node, 0), name, info2, node.toString()); } - private INode getType(String typeName, List ast) - { - for (INode node : ast) - { - if (AstNameUtil.getName(node).equals(typeName)) - { - return node; - } - } - return null; - } - - private List getFields(INode node) - { - List fields = new Vector(); - List list = getDefinitions(node); - - if (list != null) - { - for (PDefinition definition : list) - { - if (definition instanceof ALocalDefinition - || definition instanceof AValueDefinition - || definition instanceof AInstanceVariableDefinition) - { - fields.add(definition); - } - } - } - return fields; - } - - private List getTypes(INode node) - { - List types = new Vector(); - List list = getDefinitions(node); - if (list != null) - { - for (PDefinition definition : list) - { - if (definition instanceof ATypeDefinition) - { - types.add(definition); - } - } - } - return types; - } - - private List getOperations(INode node) - { - List ops = new Vector(); - List list = getDefinitions(node); - - if (list != null) - { - for (PDefinition definition : list) - { - if (definition instanceof AExplicitOperationDefinition - || definition instanceof AImplicitOperationDefinition) - { - ops.add(definition); - } - } - } - return ops; - } - - private List getFunctions(INode node) - { - List fns = new Vector(); - List list = getDefinitions(node); - - if (list != null) - { - for (PDefinition definition : list) - { - if (definition instanceof AExplicitFunctionDefinition - || definition instanceof AImplicitFunctionDefinition) - { - fns.add(definition); - } - } - } - return fns; - } - - private List getDefinitions(INode node) - { - List list = null; - if (node instanceof SClassDefinition) - { - list = ((SClassDefinition) node).getDefinitions(); - } else if (node instanceof AModuleModules) - { - list = ((AModuleModules) node).getDefs(); - } - return list; - } - private List getAst(VdmDocument document) { List ast = new Vector(); From 3e7994cfaeaaef2d0d59435ceae248d5ff321b92 Mon Sep 17 00:00:00 2001 From: gkanos Date: Wed, 4 Mar 2015 14:54:53 +0100 Subject: [PATCH 015/706] Auto complete of mk_ for records. --- .../ide/ui/CompletionContextTest.java | 12 +++++ .../ide/ui/completion/CompletionUtil.java | 6 +++ .../ui/templates/VdmCompleteProcessor.java | 54 +++++++++++++++++++ .../ui/templates/VdmCompletionContext.java | 27 +++++++++- 4 files changed, 98 insertions(+), 1 deletion(-) diff --git a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java index a3744abd3f..76085aaed9 100644 --- a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java +++ b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java @@ -13,6 +13,18 @@ public class CompletionContextTest private static final String PROPOSAL_PREFIX_ERROR_MSG = "Incorrect proposal prefix"; private static final String OFFSET_ERROR_MSG = "Incorrect offset"; + @Test + public void testMk_RecName() + { + commonTest("let x = mk_F", 12, "F", SearchType.Mk); + } + + @Test + public void testMk_RecEmpty() + { + commonTest("let x = mk_", 11, "", SearchType.Mk); + } + @Test public void testDot_Field() { diff --git a/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java b/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java index c29ce7784b..709d8a1070 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java @@ -51,11 +51,17 @@ public static VdmCompletionContext computeVdmCompletionContext(IDocument doc, scanned.append(c); + // The 'new' keyword if(c=='n' && scanned.length()>3&& scanned.substring(scanned.length()-4, scanned.length()).matches("\\swen")) { break; } + // The 'mk_" + else if(c == 'm' && scanned.length() >= 3 && scanned.substring(scanned.length() - 3, scanned.length()).matches("_km")) + { + break; + } } catch (BadLocationException e) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java index e16f9c958e..f6d9cf5ee2 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java @@ -70,6 +70,7 @@ public void computeCompletionProposals(VdmCompletionContext info, case Dot: break; case Mk: + completeMK(info, document, calculatedProposals,offset); break; case New: completeNew(info, document, calculatedProposals, offset); @@ -103,6 +104,15 @@ public void computeCompletionProposals(VdmCompletionContext info, } } + private void completeMK(VdmCompletionContext info, VdmDocument document, + List calculatedProposals, int offset) { + + for(INode def : getAst(document)) + { + completeRecords(offset, calculatedProposals, info, def); + } + } + private void completeQuotes(final VdmCompletionContext info, VdmDocument document, final List proposals, int offset) @@ -164,6 +174,50 @@ && new PAccessSpecifierAssistant(null).isPublic(node.getAccess())) } } } + + private void completeRecords(final int offset, + final List calculatedProposals, + VdmCompletionContext info, final INode def) { + + try { + def.apply(new DepthFirstAnalysisAdaptor() { + + @Override + public void caseARecordInvariantType(ARecordInvariantType arg0) + throws AnalysisException { + + String name = arg0.getName().getName(); + IContextInformation info = new ContextInformation(name, name); //$NON-NLS-1$ + + + + + String replacementString = name + "("; + String displayString = replacementString; + + String sep = ""; + + for (Iterator iterator = arg0.getFields().iterator(); iterator.hasNext();) + { + AFieldField field = iterator.next(); + + replacementString += sep + field.getTagname().getName(); + displayString += sep + field.toString(); + sep = ", "; + + } + + replacementString += ")"; + displayString += ")"; + + calculatedProposals.add(new CompletionProposal(replacementString , offset, 0, replacementString.length(), imgProvider.getImageLabel(def, 0), replacementString, info, displayString)); + } + }); + } catch (AnalysisException e) { + VdmUIPlugin.log("Completion error in " + getClass().getSimpleName() + + "faild during record search", e); + } + } public void completeTypes(VdmCompletionContext info, VdmDocument document, List proposals, int offset) diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java index 62b4d2afea..bd287fd596 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java @@ -38,13 +38,22 @@ private void init() index = rawScan.toString().indexOf("new"); - // New must appear at the first index of the raw scan + // 'new' must appear at the first index of the raw scan if (index == 0) { // Completion of constructors consConstructorCallContext(); return; } + + index = rawScan.toString().indexOf("mk_"); + + // 'mk_' must appear at the first index of the raw scan + if(index == 0) + { + consMkContext(); + return; + } // Completion for foo.bar. This covers things such as instance variables, // values, a record, a tuple, operations and functions @@ -84,6 +93,22 @@ private void consConstructorCallContext() type = SearchType.New; } + + /** + * Constructs the completion context for a 'mk_' call + * + */ + private void consMkContext() { + + final int MK_LENGTH = "mk_".length(); + + CharSequence subSeq = rawScan.subSequence(MK_LENGTH, rawScan.length()); + processedScan = new StringBuffer(subSeq); + proposalPrefix = processedScan.toString().trim(); + + type = SearchType.Mk; + } + /** * Constructs the completion context for quotes From 45b4f0091058f33dbe09e8999ce4a882b32ba672 Mon Sep 17 00:00:00 2001 From: gkanos Date: Thu, 5 Mar 2015 10:28:56 +0100 Subject: [PATCH 016/706] #423 added the mk_token completion --- .../ide/ui/CompletionContextTest.java | 2 +- .../ide/ui/completion/CompletionUtil.java | 6 +++++ .../ui/templates/VdmCompleteProcessor.java | 18 +++++++++++++-- .../ui/templates/VdmCompletionContext.java | 22 +++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java index 76085aaed9..8250f71efb 100644 --- a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java +++ b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java @@ -12,7 +12,7 @@ public class CompletionContextTest private static final String SEARCH_TYPE_ERROR_MSG = "Incorrect search type"; private static final String PROPOSAL_PREFIX_ERROR_MSG = "Incorrect proposal prefix"; private static final String OFFSET_ERROR_MSG = "Incorrect offset"; - + @Test public void testMk_RecName() { diff --git a/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java b/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java index 709d8a1070..f153665127 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/completion/CompletionUtil.java @@ -57,12 +57,18 @@ public static VdmCompletionContext computeVdmCompletionContext(IDocument doc, break; } +// //The 'mk_token' +// else if (c == 't' && scanned.length() >= 4 && scanned.substring(scanned.length() - 4, scanned.length()).matches("t_km")) +// { +// break; +// } // The 'mk_" else if(c == 'm' && scanned.length() >= 3 && scanned.substring(scanned.length() - 3, scanned.length()).matches("_km")) { break; } + } catch (BadLocationException e) { diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java index f6d9cf5ee2..dc985e562e 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java @@ -36,6 +36,7 @@ import org.overture.ast.definitions.ATypeDefinition; import org.overture.ast.definitions.PDefinition; import org.overture.ast.definitions.SClassDefinition; +import org.overture.ast.expressions.AMkBasicExp; import org.overture.ast.expressions.AQuoteLiteralExp; import org.overture.ast.expressions.PExp; import org.overture.ast.modules.AModuleModules; @@ -45,6 +46,7 @@ import org.overture.ast.types.AFieldField; import org.overture.ast.types.AQuoteType; import org.overture.ast.types.ARecordInvariantType; +import org.overture.ast.types.ATokenBasicType; import org.overture.ast.types.PType; import org.overture.ide.ui.VdmUIPlugin; import org.overture.ide.ui.editor.core.VdmDocument; @@ -110,7 +112,8 @@ private void completeMK(VdmCompletionContext info, VdmDocument document, for(INode def : getAst(document)) { completeRecords(offset, calculatedProposals, info, def); - } + completeMk_tokens(offset,calculatedProposals,info, def); + } } private void completeQuotes(final VdmCompletionContext info, @@ -181,7 +184,6 @@ private void completeRecords(final int offset, try { def.apply(new DepthFirstAnalysisAdaptor() { - @Override public void caseARecordInvariantType(ARecordInvariantType arg0) throws AnalysisException { @@ -217,6 +219,18 @@ public void caseARecordInvariantType(ARecordInvariantType arg0) VdmUIPlugin.log("Completion error in " + getClass().getSimpleName() + "faild during record search", e); } + + } + + private void completeMk_tokens(final int offset, + final List calculatedProposals, + final VdmCompletionContext info, INode def) { + + String name = "token()"; + String display = "mk_token() Token Representation, can take arbitary expression"; + IContextInformation ctxtInfo = new ContextInformation(name, name); //$NON-NLS-1$ + calculatedProposals.add(new CompletionProposal(name, offset, 0, name.length() - 1, imgProvider.getImageLabel(def, 0), name, ctxtInfo, display)); + } public void completeTypes(VdmCompletionContext info, VdmDocument document, diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java index bd287fd596..acaf041859 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java @@ -54,6 +54,15 @@ private void init() consMkContext(); return; } + +// index = rawScan.toString().indexOf("mk_t"); + + //for the 'mk_token' the user have to type mk_t +// if(index == 0) +// { +// consMK_tokenContext(); +// return; +// } // Completion for foo.bar. This covers things such as instance variables, // values, a record, a tuple, operations and functions @@ -109,6 +118,19 @@ private void consMkContext() { type = SearchType.Mk; } + /** + * Contrusts the completion context for the 'mk_token' call + */ +// private void consMK_tokenContext() { +// final int MK_LENGTH = "mk_t".length(); +// +// CharSequence subSeq = rawScan.subSequence(MK_LENGTH, rawScan.length()); +// processedScan = new StringBuffer(subSeq); +// proposalPrefix = processedScan.toString().trim(); +// +// type = SearchType.Mk; +// +// } /** * Constructs the completion context for quotes From 7a9a3ed9d3b629def1c4ffc323a8f601cde6a1b0 Mon Sep 17 00:00:00 2001 From: gkanos Date: Mon, 9 Mar 2015 15:46:58 +0100 Subject: [PATCH 017/706] code clean up --- .../ide/ui/CompletionContextTest.java | 6 +++ .../ui/templates/VdmCompleteProcessor.java | 48 ++++++++++++++++++- .../ui/templates/VdmCompletionContext.java | 9 ---- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java index 8250f71efb..eb2fadb100 100644 --- a/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java +++ b/ide/ui.tests/src/main/java/org/overture/ide/ui/CompletionContextTest.java @@ -13,6 +13,12 @@ public class CompletionContextTest private static final String PROPOSAL_PREFIX_ERROR_MSG = "Incorrect proposal prefix"; private static final String OFFSET_ERROR_MSG = "Incorrect offset"; + @Test + public void testMK_tuples() + { + commonTest("let x = mk_(", 12, "(", SearchType.Mk); + } + @Test public void testMk_RecName() { diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java index dc985e562e..501cfa59ae 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompleteProcessor.java @@ -44,9 +44,11 @@ import org.overture.ast.patterns.PPattern; import org.overture.ast.statements.PStm; import org.overture.ast.types.AFieldField; +import org.overture.ast.types.AProductType; import org.overture.ast.types.AQuoteType; import org.overture.ast.types.ARecordInvariantType; import org.overture.ast.types.ATokenBasicType; +import org.overture.ast.types.AUnionType; import org.overture.ast.types.PType; import org.overture.ide.ui.VdmUIPlugin; import org.overture.ide.ui.editor.core.VdmDocument; @@ -113,6 +115,7 @@ private void completeMK(VdmCompletionContext info, VdmDocument document, { completeRecords(offset, calculatedProposals, info, def); completeMk_tokens(offset,calculatedProposals,info, def); + completetuples(offset, calculatedProposals, info,def); } } @@ -222,12 +225,55 @@ public void caseARecordInvariantType(ARecordInvariantType arg0) } + private void completetuples(final int offset, + final List calculatedProposals, + final VdmCompletionContext info, final INode def) { + try + { + def.apply(new DepthFirstAnalysisAdaptor() { + @Override + public void caseAProductType(AProductType arg0) + throws AnalysisException { + + String name = arg0.toString(); + IContextInformation info = new ContextInformation(name, name); + + String replacementString = "("; + //String display = replacementString; + + String sep = ""; + + for(Iterator iterator = arg0.getDefinitions().iterator(); iterator.hasNext();) + { + PDefinition type = iterator.next(); + replacementString += sep + type.getType(); + //display += sep + type.toString(); + sep = ", "; + } + replacementString += ")"; + //display += ")"; + + calculatedProposals.add(new CompletionProposal(replacementString , offset, 0, replacementString.length(), imgProvider.getImageLabel(def, 0), replacementString, info, replacementString)); + } + }); + + } + catch(AnalysisException e) + { + VdmUIPlugin.log("Completion error in " + getClass().getSimpleName() + + "faild during tuple search", e); + } + // + + + } + private void completeMk_tokens(final int offset, final List calculatedProposals, final VdmCompletionContext info, INode def) { String name = "token()"; - String display = "mk_token() Token Representation, can take arbitary expression"; + String display = "mk_token() Token Representation, can take an arbitary expression"; IContextInformation ctxtInfo = new ContextInformation(name, name); //$NON-NLS-1$ calculatedProposals.add(new CompletionProposal(name, offset, 0, name.length() - 1, imgProvider.getImageLabel(def, 0), name, ctxtInfo, display)); diff --git a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java index acaf041859..5f59a1f859 100644 --- a/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java +++ b/ide/ui/src/main/java/org/overture/ide/ui/templates/VdmCompletionContext.java @@ -54,15 +54,6 @@ private void init() consMkContext(); return; } - -// index = rawScan.toString().indexOf("mk_t"); - - //for the 'mk_token' the user have to type mk_t -// if(index == 0) -// { -// consMK_tokenContext(); -// return; -// } // Completion for foo.bar. This covers things such as instance variables, // values, a record, a tuple, operations and functions From b77c510d14e63538dbb158ef8c186c11cb08bd41 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:30:11 +0200 Subject: [PATCH 018/706] Add 2 example models to isagen integration test --- .../test/resources/integration/airport.vdmsl | 64 +++++++++++++++++++ .../test/resources/integration/alarm.vdmsl | 49 ++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 core/isapog/src/test/resources/integration/airport.vdmsl create mode 100644 core/isapog/src/test/resources/integration/alarm.vdmsl diff --git a/core/isapog/src/test/resources/integration/airport.vdmsl b/core/isapog/src/test/resources/integration/airport.vdmsl new file mode 100644 index 0000000000..8cf861a61d --- /dev/null +++ b/core/isapog/src/test/resources/integration/airport.vdmsl @@ -0,0 +1,64 @@ +-- Permissions for landings and takeoffs on an airport. +-- Original VDM model from Quentin Charatan and Aaron Kans. From VDM to Java. +-- Adapted to CML by Jim Woodcock. CML Examples Compendium. +-- CML model adapted to VDM-SL by Luis Diogo Couto + +types +Aircraft = token + +state A of + permission : set of Aircraft + landed : set of Aircraft + inv mk_A(per,lan) == lan subset per + init s == s = mk_A({},{}) +end + +functions +permitted: Aircraft * set of Aircraft -> bool +permitted(a,perm) == + a in set perm; + +down: Aircraft * set of Aircraft -> bool +down(a,land) == + a in set land; + +PreRecordLanding: Aircraft * set of Aircraft * set of Aircraft -> bool +PreRecordLanding(a,p,l) == + permitted(a,p) and not down(a,l); + +operations +Init : () ==> () +Init() == + (permission := {} ; landed := {}); + +GivePermission : Aircraft ==> () +GivePermission(a) == + permission := permission union {a} +pre not permitted(a,permission); + +RecordLanding : Aircraft ==> () +RecordLanding(a) == + landed := landed union {a} +pre PreRecordLanding(a,permission,landed); + +RecordTakeOff : Aircraft ==> () +RecordTakeOff(a) == + atomic ( + landed := landed \ {a}; + permission := permission \ {a} ) +pre down(a,landed); + +NumberWaiting : () ==> nat +NumberWaiting() == + return card (permission \ landed); + +traces +t1: + let p1,p2 in set {mk_token("1"),mk_token("2"),mk_token("3")} + in + ( + (GivePermission(p1) ; RecordLanding(p1) ; RecordTakeOff(p1)) + | + (GivePermission(p2) ; RecordLanding(p2) ; RecordTakeOff(p2)) + ) {3} + \ No newline at end of file diff --git a/core/isapog/src/test/resources/integration/alarm.vdmsl b/core/isapog/src/test/resources/integration/alarm.vdmsl new file mode 100644 index 0000000000..4f2fc65e78 --- /dev/null +++ b/core/isapog/src/test/resources/integration/alarm.vdmsl @@ -0,0 +1,49 @@ +types + Period = token; + + ExpertId = token; + + Qualification = | | | ; + + Expert :: expertid : ExpertId + eQuali : set of Qualification + inv ex == ex.eQuali <> {}; + + Alarm :: aQuali : Qualification + alarmtext : seq of char; + + Schedule = map Period to set of Expert +inv sch == + forall exs in set rng sch & + exs <> {} and + forall ex1, ex2 in set exs & + ex1 <> ex2 => ex1.expertid <> ex2.expertid; + + + Plant :: schedule : Schedule + alarms : set of Alarm + inv p == + forall a in set p.alarms & + forall peri in set dom p.schedule & true; + +functions + + NumberOfExperts: Period * Plant -> nat + NumberOfExperts(peri,plant) == + card plant.schedule(peri) + pre peri in set dom plant.schedule; + + ExpertIsOnDuty: Expert * Plant -> set of Period + ExpertIsOnDuty(ex,p) == + {peri| peri in set dom p.schedule & ex in set p.schedule(peri)}; + + ExpertToPage(a:Alarm,peri:Period,plant:Plant) r: Expert + pre peri in set dom plant.schedule and + a in set plant.alarms + post r in set plant.schedule(peri) and + a.aQuali in set r.eQuali; + + QualificationOK: set of Expert * Qualification -> bool + QualificationOK(exs,reqquali) == + exists ex in set exs & reqquali in set ex.eQuali; + From f39f1e2f6a2d276381447ba163aa39bb42df8626 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:30:30 +0200 Subject: [PATCH 019/706] Update poms. --- core/codegen/isagen/pom.xml | 2 +- core/isapog/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/codegen/isagen/pom.xml b/core/codegen/isagen/pom.xml index b2f3465ea8..bb48840a5c 100644 --- a/core/codegen/isagen/pom.xml +++ b/core/codegen/isagen/pom.xml @@ -5,7 +5,7 @@ org.overturetool.core codegen - 2.2.5-SNAPSHOT + 2.2.7-SNAPSHOT ../pom.xml diff --git a/core/isapog/pom.xml b/core/isapog/pom.xml index c936aa0f38..e10548d3d5 100644 --- a/core/isapog/pom.xml +++ b/core/isapog/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.2.5-SNAPSHOT + 2.2.7-SNAPSHOT ../pom.xml From 33fc4cbb47f609e9bb2b9d5c7e471310da751577 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:31:09 +0200 Subject: [PATCH 020/706] Add isapog integration models to pog tests. --- .../src/test/resources/integration/new/airport.vdmsl} | 0 .../src/test/resources/integration/new/alarm.vdmsl} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename core/{isapog/src/test/resources/integration/airport.vdmsl.skip => pog/src/test/resources/integration/new/airport.vdmsl} (100%) rename core/{isapog/src/test/resources/integration/alarm.vdmsl.skip => pog/src/test/resources/integration/new/alarm.vdmsl} (100%) diff --git a/core/isapog/src/test/resources/integration/airport.vdmsl.skip b/core/pog/src/test/resources/integration/new/airport.vdmsl similarity index 100% rename from core/isapog/src/test/resources/integration/airport.vdmsl.skip rename to core/pog/src/test/resources/integration/new/airport.vdmsl diff --git a/core/isapog/src/test/resources/integration/alarm.vdmsl.skip b/core/pog/src/test/resources/integration/new/alarm.vdmsl similarity index 100% rename from core/isapog/src/test/resources/integration/alarm.vdmsl.skip rename to core/pog/src/test/resources/integration/new/alarm.vdmsl From 1454e81aae408db03efb12ea6eef0c2d5c8ffa11 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:32:11 +0200 Subject: [PATCH 021/706] Remove unsupported constructs from airport model --- core/isapog/src/test/resources/integration/airport.vdmsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/isapog/src/test/resources/integration/airport.vdmsl b/core/isapog/src/test/resources/integration/airport.vdmsl index 8cf861a61d..0fa3762cda 100644 --- a/core/isapog/src/test/resources/integration/airport.vdmsl +++ b/core/isapog/src/test/resources/integration/airport.vdmsl @@ -9,7 +9,7 @@ Aircraft = token state A of permission : set of Aircraft landed : set of Aircraft - inv mk_A(per,lan) == lan subset per + inv s == s.landed subset s.permission init s == s = mk_A({},{}) end From da607176de381d2d62683379b2da406785123be5 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:32:35 +0200 Subject: [PATCH 022/706] Add LetDef Template --- .../java/org/overturetool/cgisa/IsaTemplateManager.java | 4 ++++ .../resources/IsaTemplates/Expressions/Misc/LetDef.vm | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Misc/LetDef.vm diff --git a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java index 953b7092fd..532797ae51 100644 --- a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java +++ b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java @@ -23,6 +23,7 @@ import java.io.File; +import org.overture.ast.expressions.ALetDefExp; import org.overture.cgisa.extast.declarations.AMrFuncGroupDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AFuncDeclCG; @@ -34,6 +35,7 @@ import org.overture.codegen.cgast.expressions.AExplicitVarExpCG; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; import org.overture.codegen.cgast.expressions.AIntLiteralExpCG; +import org.overture.codegen.cgast.expressions.ALetDefExpCG; import org.overture.codegen.cgast.expressions.ANotImplementedExpCG; import org.overture.codegen.cgast.expressions.ARealLiteralExpCG; import org.overture.codegen.cgast.expressions.ATernaryIfExpCG; @@ -137,6 +139,8 @@ private void initIsaNodes() nodeTemplateFileNames.put(ANotImplementedExpCG.class, templateStructure.EXP_PATH + MISC_EXP_PATH + File.separatorChar + NOT_IMPL_EXP); + + nodeTemplateFileNames.put(ALetDefExpCG.class, templateStructure) } } diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Misc/LetDef.vm b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Misc/LetDef.vm new file mode 100644 index 0000000000..1dffba9fbe --- /dev/null +++ b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Misc/LetDef.vm @@ -0,0 +1,9 @@ +#set( $root = $Isa.trans($node.Root) ) +#set( $args = $Isa.transApplyParams($node.Args)) +#if ($Isa.isFunc($node.Root.Type) ) +${root}(${args})## +#elseif ($Isa.isRootRec($node)) +${root}[${args}]## +#else +$root<$args>## +#end \ No newline at end of file From 9f136ecf0aa078f1fee8bdd24b4ca1e8575af58e Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:33:15 +0200 Subject: [PATCH 023/706] Restructure PO integrity tests. Now have a general integrity test that can be subclassed with specific checks like Type and VarDef --- .../pog/tests/newtests/AbsIntegrityTest.java | 61 +++++++++++++++++++ .../pog/tests/newtests/IntegrityCheck.java | 13 ++++ .../tests/newtests/VarDefIntegrityTest.java | 31 ++++++++++ .../newtests/VarDefIntegrityVisitor.java | 31 ++++++++++ 4 files changed, 136 insertions(+) create mode 100644 core/pog/src/test/java/org/overture/pog/tests/newtests/AbsIntegrityTest.java create mode 100644 core/pog/src/test/java/org/overture/pog/tests/newtests/IntegrityCheck.java create mode 100644 core/pog/src/test/java/org/overture/pog/tests/newtests/VarDefIntegrityTest.java create mode 100644 core/pog/src/test/java/org/overture/pog/tests/newtests/VarDefIntegrityVisitor.java diff --git a/core/pog/src/test/java/org/overture/pog/tests/newtests/AbsIntegrityTest.java b/core/pog/src/test/java/org/overture/pog/tests/newtests/AbsIntegrityTest.java new file mode 100644 index 0000000000..d9b3e12b5a --- /dev/null +++ b/core/pog/src/test/java/org/overture/pog/tests/newtests/AbsIntegrityTest.java @@ -0,0 +1,61 @@ +package org.overture.pog.tests.newtests; + +import static org.junit.Assert.fail; + +import java.util.List; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.overture.ast.analysis.AnalysisException; +import org.overture.ast.node.INode; +import org.overture.core.tests.NoResultFileTest; +import org.overture.pog.pub.IProofObligation; +import org.overture.pog.pub.IProofObligationList; +import org.overture.pog.pub.ProofObligationGenerator; + +@RunWith(Parameterized.class) +public abstract class AbsIntegrityTest extends NoResultFileTest +{ + + protected final IntegrityCheck icVisitor; + + public AbsIntegrityTest(String nameParameter, String testParameter, + IntegrityCheck icVisitor) + { + super(nameParameter, testParameter); + this.icVisitor = icVisitor; + } + + @Override + public Boolean processModel(List arg0) + { + try + { + IProofObligationList ipol = ProofObligationGenerator.generateProofObligations(arg0); + + for (IProofObligation po : ipol) + { + po.getValueTree().getPredicate().apply(icVisitor); + if (!icVisitor.getProblemNodes().isEmpty()) + { + fail("Integrity error in" + po.toString() + + "\n Problem Nodes: \n" + + icVisitor.getProblemNodes().toString()); + } + } + + } catch (AnalysisException e) + { + fail("Could not process " + testName); + + } + return true; + } + + @Override + protected void processResult(Boolean actual) + { + // dont need to do anything + } + +} diff --git a/core/pog/src/test/java/org/overture/pog/tests/newtests/IntegrityCheck.java b/core/pog/src/test/java/org/overture/pog/tests/newtests/IntegrityCheck.java new file mode 100644 index 0000000000..9ad6cac27c --- /dev/null +++ b/core/pog/src/test/java/org/overture/pog/tests/newtests/IntegrityCheck.java @@ -0,0 +1,13 @@ +package org.overture.pog.tests.newtests; + +import java.util.List; + +import org.overture.ast.analysis.intf.IAnalysis; +import org.overture.ast.node.INode; + +public interface IntegrityCheck extends IAnalysis +{ + + public List getProblemNodes(); + +} diff --git a/core/pog/src/test/java/org/overture/pog/tests/newtests/VarDefIntegrityTest.java b/core/pog/src/test/java/org/overture/pog/tests/newtests/VarDefIntegrityTest.java new file mode 100644 index 0000000000..c56ea9d17b --- /dev/null +++ b/core/pog/src/test/java/org/overture/pog/tests/newtests/VarDefIntegrityTest.java @@ -0,0 +1,31 @@ +package org.overture.pog.tests.newtests; + +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.core.tests.PathsProvider; + +@RunWith(Parameterized.class) +public class VarDefIntegrityTest extends AbsIntegrityTest +{ + + private static final String MICRO_INPUTS = "src/test/resources/micro"; + private static final String INTEGRATION_INPUTS = "src/test/resources/integration/new"; + + public VarDefIntegrityTest(String nameParameter, String testParameter) + { + super(nameParameter, testParameter,new VarDefIntegrityVisitor()); + + } + + @Parameters(name = "{index} : {0}") + public static Collection testData() + { + return PathsProvider.computePathsNoResultFiles(MICRO_INPUTS,INTEGRATION_INPUTS); + } + + + +} diff --git a/core/pog/src/test/java/org/overture/pog/tests/newtests/VarDefIntegrityVisitor.java b/core/pog/src/test/java/org/overture/pog/tests/newtests/VarDefIntegrityVisitor.java new file mode 100644 index 0000000000..d881c611ce --- /dev/null +++ b/core/pog/src/test/java/org/overture/pog/tests/newtests/VarDefIntegrityVisitor.java @@ -0,0 +1,31 @@ +package org.overture.pog.tests.newtests; + +import java.util.List; +import java.util.Vector; + +import org.overture.ast.analysis.AnalysisException; +import org.overture.ast.analysis.DepthFirstAnalysisAdaptor; +import org.overture.ast.expressions.AVariableExp; +import org.overture.ast.node.INode; + +public class VarDefIntegrityVisitor extends DepthFirstAnalysisAdaptor implements IntegrityCheck +{ + + List problemNodes = new Vector(); + + @Override + public void inAVariableExp(AVariableExp node) throws AnalysisException + { + if (node.getVardef() == null) + { + problemNodes.add(node); + } + } + + @Override + public List getProblemNodes() + { + return problemNodes; + } + +} From 4ec43542bdd6e929e9df337628b7e0ad6277bd15 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:33:44 +0200 Subject: [PATCH 024/706] Add complete version of getVarExp --- .../org/overture/pog/obligation/ProofObligation.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java b/core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java index d80ba6e5ec..8cc97028e5 100644 --- a/core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java +++ b/core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java @@ -350,6 +350,15 @@ protected AVariableExp getVarExp(ILexNameToken name, PDefinition vardef) var.setVardef(vardef.clone()); return var; } + /** + * Generate Var Exp with everything! + * @return + */ + protected AVariableExp getVarExp(ILexNameToken name, PDefinition vardef, PType type){ + AVariableExp var = getVarExp(name, vardef); + var.setType(type); + return var; + } protected AApplyExp getApplyExp(PExp root, PType type, PExp... arglist) { From 887b053ca67d1faf0a6ff6aaa3ab5aac4eabc541 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:34:06 +0200 Subject: [PATCH 025/706] Refactor type integrity test to use new structure. --- .../tests/newtests/PogTypeIntegrityTest.java | 49 ++----------------- .../tests/newtests/TypeIntegrityVisitor.java | 36 +++++++++++--- 2 files changed, 34 insertions(+), 51 deletions(-) diff --git a/core/pog/src/test/java/org/overture/pog/tests/newtests/PogTypeIntegrityTest.java b/core/pog/src/test/java/org/overture/pog/tests/newtests/PogTypeIntegrityTest.java index 518940caaa..daff03e961 100644 --- a/core/pog/src/test/java/org/overture/pog/tests/newtests/PogTypeIntegrityTest.java +++ b/core/pog/src/test/java/org/overture/pog/tests/newtests/PogTypeIntegrityTest.java @@ -1,70 +1,31 @@ package org.overture.pog.tests.newtests; -import static org.junit.Assert.fail; - import java.util.Collection; -import java.util.List; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import org.overture.ast.analysis.AnalysisException; -import org.overture.ast.node.INode; -import org.overture.core.tests.NoResultFileTest; import org.overture.core.tests.PathsProvider; -import org.overture.pog.pub.IProofObligation; -import org.overture.pog.pub.IProofObligationList; -import org.overture.pog.pub.ProofObligationGenerator; @RunWith(Parameterized.class) -public class PogTypeIntegrityTest extends NoResultFileTest +public class PogTypeIntegrityTest extends AbsIntegrityTest { private static final String MICRO_INPUTS = "src/test/resources/micro"; + private static final String INTEGRATION_INPUTS = "src/test/resources/integration/new"; - private TypeIntegrityVisitor tiVisitor = new TypeIntegrityVisitor(); - public PogTypeIntegrityTest(String nameParameter, String testParameter) { - super(nameParameter, testParameter); + super(nameParameter, testParameter,new TypeIntegrityVisitor()); + } @Parameters(name = "{index} : {0}") public static Collection testData() { - return PathsProvider.computePathsNoResultFiles(MICRO_INPUTS); + return PathsProvider.computePathsNoResultFiles(MICRO_INPUTS,INTEGRATION_INPUTS); } - @Override - public Boolean processModel(List arg0) - { - try - { - IProofObligationList ipol = ProofObligationGenerator.generateProofObligations(arg0); - - for (IProofObligation po : ipol) - { - po.getValueTree().getPredicate().apply(tiVisitor); - if (!tiVisitor.getUntypeExps().isEmpty()) - { - fail("Type integrity error in" + po.toString() - + "\n Untyped Exps: \n" - + tiVisitor.getUntypeExps().toString()); - } - } - - } catch (AnalysisException e) - { - fail("Could not process " + testName); - } - return true; - } - - @Override - protected void processResult(Boolean actual) - { - // dont need to do anything - } } diff --git a/core/pog/src/test/java/org/overture/pog/tests/newtests/TypeIntegrityVisitor.java b/core/pog/src/test/java/org/overture/pog/tests/newtests/TypeIntegrityVisitor.java index 93ed484e09..da95485a4c 100644 --- a/core/pog/src/test/java/org/overture/pog/tests/newtests/TypeIntegrityVisitor.java +++ b/core/pog/src/test/java/org/overture/pog/tests/newtests/TypeIntegrityVisitor.java @@ -5,37 +5,59 @@ import org.overture.ast.analysis.AnalysisException; import org.overture.ast.analysis.DepthFirstAnalysisAdaptor; +import org.overture.ast.definitions.AEqualsDefinition; import org.overture.ast.expressions.PExp; +import org.overture.ast.node.INode; import org.overture.ast.types.AFunctionType; +import org.overture.ast.types.ARecordInvariantType; -public class TypeIntegrityVisitor extends DepthFirstAnalysisAdaptor +public class TypeIntegrityVisitor extends DepthFirstAnalysisAdaptor implements IntegrityCheck { - List untypeExps = new Vector(); + List untypeNodes = new Vector(); @Override public void defaultInPExp(PExp node) throws AnalysisException { if (node.getType() == null) { - untypeExps.add(node); + untypeNodes.add(node); } } - public List getUntypeExps() + @Override + public List getProblemNodes() { - return untypeExps; + return untypeNodes; } + public void reset() { - untypeExps.clear(); + untypeNodes.clear(); + } + + @Override + public void caseAEqualsDefinition(AEqualsDefinition node) + throws AnalysisException + { + if (node.getExpType() == null) + { + untypeNodes.add(node); + } } - + @Override public void caseAFunctionType(AFunctionType node) throws AnalysisException { // do nothing } + @Override + public void caseARecordInvariantType(ARecordInvariantType node) + throws AnalysisException + { + // do nothing + } + } From 151fb14732745ef2c1383bf4d380b89e9f9b34a6 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 09:34:25 +0200 Subject: [PATCH 026/706] Add missing types and vardefs to POs --- .../pog/obligation/FunctionPostCondition.java | 6 ++---- .../obligation/SatisfiabilityObligation.java | 20 +++++++++---------- .../obligation/StateInvariantObligation.java | 13 +++++++----- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/core/pog/src/main/java/org/overture/pog/obligation/FunctionPostCondition.java b/core/pog/src/main/java/org/overture/pog/obligation/FunctionPostCondition.java index 21410a2365..5ef115aa0c 100644 --- a/core/pog/src/main/java/org/overture/pog/obligation/FunctionPostCondition.java +++ b/core/pog/src/main/java/org/overture/pog/obligation/FunctionPostCondition.java @@ -72,8 +72,7 @@ public FunctionPostCondition(AExplicitFunctionDefinition func, { AApplyExp applyExp = new AApplyExp(); applyExp.setArgs(params); - AVariableExp varExp = new AVariableExp(); - varExp.setName(func.getName()); + AVariableExp varExp = getVarExp(func.getName().clone(), func.clone(), func.getType().clone()); applyExp.setRoot(varExp); // We have to say "f(a)" because we have no expression yet // I suppose this still still holds true with ast pos @@ -117,8 +116,7 @@ public FunctionPostCondition(AImplicitFunctionDefinition func, { AApplyExp applyExp = new AApplyExp(); applyExp.setArgs(params); - AVariableExp varExp = new AVariableExp(); - varExp.setName(func.getName().clone()); + AVariableExp varExp = getVarExp(func.getName().clone(), func.clone(), func.getType().clone()); applyExp.setRoot(varExp); body = applyExp; } else diff --git a/core/pog/src/main/java/org/overture/pog/obligation/SatisfiabilityObligation.java b/core/pog/src/main/java/org/overture/pog/obligation/SatisfiabilityObligation.java index 8d0c0c142e..ee864165ff 100644 --- a/core/pog/src/main/java/org/overture/pog/obligation/SatisfiabilityObligation.java +++ b/core/pog/src/main/java/org/overture/pog/obligation/SatisfiabilityObligation.java @@ -243,18 +243,18 @@ PExp buildPredicate(AImplicitOperationDefinition op, if (stateDefinition instanceof AStateDefinition) { - AVariableExp varExp = getVarExp(OLD_STATE_ARG); + AVariableExp varExp = getVarExp(OLD_STATE_ARG,stateDefinition.clone()); varExp.setType(((AStateDefinition) stateDefinition).getRecordType().clone()); postArglist.add(varExp); - AVariableExp varExp2 = getVarExp(NEW_STATE_ARG); + AVariableExp varExp2 = getVarExp(NEW_STATE_ARG,stateDefinition.clone()); varExp2.setType(((AStateDefinition) stateDefinition).getRecordType().clone()); postArglist.add(varExp2); } else { - AVariableExp varExp = getVarExp(OLD_SELF_ARG); + AVariableExp varExp = getVarExp(OLD_SELF_ARG,stateDefinition.clone()); postArglist.add(varExp); varExp.setType(stateDefinition.getType().clone()); - AVariableExp varExp2 = getVarExp(NEW_SELF_ARG); + AVariableExp varExp2 = getVarExp(NEW_SELF_ARG,stateDefinition.clone()); postArglist.add(varExp2); varExp2.setType(stateDefinition.getType().clone()); } @@ -266,7 +266,7 @@ PExp buildPredicate(AImplicitOperationDefinition op, throw new RuntimeException("Expecting single identifier pattern in operation result"); } - AApplyExp postApply = getApplyExp(getVarExp(op.getPostdef().getName()), postArglist); + AApplyExp postApply = getApplyExp(getVarExp(op.getPostdef().getName(),op.getPostdef().clone()), postArglist); postApply.getRoot().setType(op.getPostdef().getType().clone()); postApply.setType(new ABooleanBasicType()); existsExp.setPredicate(postApply); @@ -287,7 +287,7 @@ PExp buildPredicate(AImplicitOperationDefinition op, stateInPost(exists_binds, postArglist, stateDefinition); } exists_exp.setBindList(exists_binds); - AApplyExp postApply = getApplyExp(getVarExp(op.getPostdef().getName()), new Vector(postArglist)); + AApplyExp postApply = getApplyExp(getVarExp(op.getPostdef().getName(),op.getPostdef().clone()), new Vector(postArglist)); postApply.setType(new ABooleanBasicType()); postApply.getRoot().setType(op.getPostdef().getType().clone()); exists_exp.setPredicate(postApply); @@ -309,11 +309,11 @@ protected void stateInPre(List args, PDefinition stateDefinition) AVariableExp varExp; if (stateDefinition instanceof AStateDefinition) { - varExp = getVarExp(OLD_STATE_ARG); + varExp = getVarExp(OLD_STATE_ARG,stateDefinition.clone()); varExp.setType(((AStateDefinition) stateDefinition).getRecordType().clone()); } else { - varExp = getVarExp(OLD_SELF_ARG); + varExp = getVarExp(OLD_SELF_ARG,stateDefinition.clone()); varExp.setType(stateDefinition.getType().clone()); } args.add(varExp); @@ -328,13 +328,13 @@ protected void stateInPost(List exists_binds, // replace with super call if (stateDefinition instanceof AStateDefinition) { - varExp = getVarExp(NEW_STATE_ARG); + varExp = getVarExp(NEW_STATE_ARG,stateDefinition.clone()); AStateDefinition aStateDefinition = (AStateDefinition) stateDefinition; varExp.setType(aStateDefinition.getRecordType().clone()); exists_binds.addAll(getMultipleTypeBindList(aStateDefinition.getRecordType().clone(), NEW_STATE_ARG)); } else { - varExp = getVarExp(NEW_SELF_ARG); + varExp = getVarExp(NEW_SELF_ARG,stateDefinition.clone()); varExp.setType(stateDefinition.getType().clone()); exists_binds.addAll(getMultipleTypeBindList(stateDefinition.getType().clone(), NEW_SELF_ARG)); } diff --git a/core/pog/src/main/java/org/overture/pog/obligation/StateInvariantObligation.java b/core/pog/src/main/java/org/overture/pog/obligation/StateInvariantObligation.java index 4521e5fbae..dd87bddc71 100644 --- a/core/pog/src/main/java/org/overture/pog/obligation/StateInvariantObligation.java +++ b/core/pog/src/main/java/org/overture/pog/obligation/StateInvariantObligation.java @@ -35,6 +35,7 @@ import org.overture.ast.definitions.AStateDefinition; import org.overture.ast.definitions.PDefinition; import org.overture.ast.definitions.SClassDefinition; +import org.overture.ast.expressions.AApplyExp; import org.overture.ast.expressions.ALetDefExp; import org.overture.ast.expressions.AVariableExp; import org.overture.ast.expressions.PExp; @@ -80,9 +81,10 @@ public StateInvariantObligation(AAssignmentStm ass, IPOContextStack ctxt, letExp.setType(def.getInvExpression().getType().clone()); List invDefs = new Vector(); AEqualsDefinition local = new AEqualsDefinition(); + local.setExpType(def.getRecordType().clone()); local.setPattern(def.getInvPattern().clone()); local.setName(def.getName().clone()); - AVariableExp varExp = getVarExp(def.getName()); + AVariableExp varExp = getVarExp(def.getName(), def.clone()); varExp.setType(def.getRecordType().clone()); local.setTest(varExp); invDefs.add(local); @@ -148,18 +150,19 @@ public StateInvariantObligation(AAtomicStm atom, IPOContextStack ctxt, private PExp makeInvApplyExp(AAtomicStm atom) { AStateDefinition stateDef = atom.getAssignments().get(0).getStateDefinition(); - if (stateDef == null){ + if (stateDef == null) + { return extractInv(atom); } String stateName = getStateName(stateDef); List arglist = new Vector(); for (AFieldField f : stateDef.getFields()) { - arglist.add(getVarExp(f.getTagname().clone(), f.getType())); + arglist.add(getVarExp(f.getTagname().clone(), stateDef.clone(),f.getType())); } PExp mkExp = AstExpressionFactory.newAMkTypeExp(new LexNameToken("", stateName, null), stateDef.getRecordType().clone(), arglist); - PExp invApplyExp = getApplyExp(getVarExp(new LexNameToken("", "inv_" - + stateName, null)), new ABooleanBasicType(), mkExp); + AApplyExp invApplyExp = getApplyExp(getVarExp(stateDef.getInitdef().getName().clone(), stateDef.getInvdef().clone(), stateDef.getInvdef().getType().clone()), new ABooleanBasicType(), mkExp); + invApplyExp.getRoot().setType(stateDef.getInvdef().getType().clone()); return invApplyExp; } From ab93e8e6a988231c3cf96da914e255798db7388e Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 10:26:03 +0200 Subject: [PATCH 027/706] Add bool type to equals exp of state init expressions. --- .../org/overture/typechecker/visitor/TypeCheckerExpVisitor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/typechecker/src/main/java/org/overture/typechecker/visitor/TypeCheckerExpVisitor.java b/core/typechecker/src/main/java/org/overture/typechecker/visitor/TypeCheckerExpVisitor.java index 52c9a2f299..9eeaa7a6cd 100644 --- a/core/typechecker/src/main/java/org/overture/typechecker/visitor/TypeCheckerExpVisitor.java +++ b/core/typechecker/src/main/java/org/overture/typechecker/visitor/TypeCheckerExpVisitor.java @@ -2564,6 +2564,8 @@ public PType caseAStateInitExp(AStateInitExp node, TypeCheckInfo question) && exp instanceof AEqualsBinaryExp) { AEqualsBinaryExp ee = (AEqualsBinaryExp) exp; + ee.setType(AstFactory.newABooleanBasicType(ee.getLocation())); + question.qualifiers = null; ee.getLeft().apply(THIS, noConstraint); From f01bbe8e4037e85dba423d94532d22d4f24b7584 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 10:26:23 +0200 Subject: [PATCH 028/706] Add record type to MkType factory constructor. --- .../org/overture/ast/factory/AstExpressionFactory.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/ast/src/main/java/org/overture/ast/factory/AstExpressionFactory.java b/core/ast/src/main/java/org/overture/ast/factory/AstExpressionFactory.java index 3397dcf244..8aef2a86d5 100644 --- a/core/ast/src/main/java/org/overture/ast/factory/AstExpressionFactory.java +++ b/core/ast/src/main/java/org/overture/ast/factory/AstExpressionFactory.java @@ -42,15 +42,22 @@ import org.overture.ast.lex.LexToken; import org.overture.ast.lex.VDMToken; import org.overture.ast.types.ABooleanBasicType; +import org.overture.ast.types.ARecordInvariantType; import org.overture.ast.types.PType; public class AstExpressionFactory { - public static AMkTypeExp newAMkTypeExp(ILexNameToken typeName, PType type, List arglist) + public static AMkTypeExp newAMkTypeExp(ILexNameToken typeName, PType type, + List arglist) { AMkTypeExp mktype = new AMkTypeExp(); mktype.setType(type); + if (type instanceof ARecordInvariantType) + { + mktype.setRecordType((ARecordInvariantType) type.clone()); + } + mktype.setTypeName(typeName); mktype.setArgs(arglist); return mktype; From 24a3310a9b9dcae30cf5e0c4e3c5ccdc9d271527 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 10:26:44 +0200 Subject: [PATCH 029/706] Check record type integrity in MkType Exps --- .../pog/tests/newtests/TypeIntegrityVisitor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/pog/src/test/java/org/overture/pog/tests/newtests/TypeIntegrityVisitor.java b/core/pog/src/test/java/org/overture/pog/tests/newtests/TypeIntegrityVisitor.java index da95485a4c..52cafed460 100644 --- a/core/pog/src/test/java/org/overture/pog/tests/newtests/TypeIntegrityVisitor.java +++ b/core/pog/src/test/java/org/overture/pog/tests/newtests/TypeIntegrityVisitor.java @@ -6,6 +6,7 @@ import org.overture.ast.analysis.AnalysisException; import org.overture.ast.analysis.DepthFirstAnalysisAdaptor; import org.overture.ast.definitions.AEqualsDefinition; +import org.overture.ast.expressions.AMkTypeExp; import org.overture.ast.expressions.PExp; import org.overture.ast.node.INode; import org.overture.ast.types.AFunctionType; @@ -47,6 +48,15 @@ public void caseAEqualsDefinition(AEqualsDefinition node) } } + @Override + public void caseAMkTypeExp(AMkTypeExp node) throws AnalysisException + { + if (node.getRecordType()==null){ + untypeNodes.add(node); + } + super.caseAMkTypeExp(node); + } + @Override public void caseAFunctionType(AFunctionType node) throws AnalysisException { From 11d39e1491144a7047c3466400aed197498db742 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 10:26:55 +0200 Subject: [PATCH 030/706] Add mkissing bool type to equals exp. --- .../overture/pog/obligation/ValueBindingObligation.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/pog/src/main/java/org/overture/pog/obligation/ValueBindingObligation.java b/core/pog/src/main/java/org/overture/pog/obligation/ValueBindingObligation.java index 68b77bed8b..92fb01d635 100644 --- a/core/pog/src/main/java/org/overture/pog/obligation/ValueBindingObligation.java +++ b/core/pog/src/main/java/org/overture/pog/obligation/ValueBindingObligation.java @@ -32,8 +32,7 @@ import org.overture.ast.expressions.AEqualsBinaryExp; import org.overture.ast.expressions.AExistsExp; import org.overture.ast.expressions.PExp; -import org.overture.ast.lex.LexKeywordToken; -import org.overture.ast.lex.VDMToken; +import org.overture.ast.factory.AstExpressionFactory; import org.overture.ast.patterns.ATypeMultipleBind; import org.overture.ast.patterns.PMultipleBind; import org.overture.ast.patterns.PPattern; @@ -74,10 +73,7 @@ public ValueBindingObligation(PPattern pattern, PType type, PExp exp, bindList.add(typeBind); existsExp.setBindList(bindList); - AEqualsBinaryExp equals = new AEqualsBinaryExp(); - equals.setLeft(patternToExp(pattern.clone())); - equals.setOp(new LexKeywordToken(VDMToken.EQUALS, null)); - equals.setRight(exp.clone()); + AEqualsBinaryExp equals = AstExpressionFactory.newAEqualsBinaryExp(patternToExp(pattern.clone()), exp.clone()); existsExp.setPredicate(equals); stitch = existsExp; From d0e2bc7e0ee98413cae74b5e1fac859f5255cd1a Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 12:35:56 +0200 Subject: [PATCH 031/706] Add templates for LocalVar and LetDefExp --- .../org/overturetool/cgisa/IsaTemplateManager.java | 13 +++++++------ .../resources/IsaTemplates/Declarations/LocalVar.vm | 1 + .../IsaTemplates/Expressions/Misc/LetDef.vm | 12 +++--------- 3 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/LocalVar.vm diff --git a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java index 532797ae51..5a65aae325 100644 --- a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java +++ b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java @@ -23,7 +23,6 @@ import java.io.File; -import org.overture.ast.expressions.ALetDefExp; import org.overture.cgisa.extast.declarations.AMrFuncGroupDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AFuncDeclCG; @@ -73,6 +72,7 @@ public class IsaTemplateManager extends TemplateManager private static final String MAP_TYPE = "Map"; private static final String NOT_IMPL_EXP = "NotImplemented"; private static final String SET_MULT_BIND = "SetMultiple"; + private static final String LET_DEF_EXP = "LetDef"; public IsaTemplateManager(TemplateStructure templateStructure, Class classRef) @@ -118,7 +118,7 @@ private void initIsaNodes() nodeTemplateFileNames.put(ATypeMultipleBindCG.class, templateStructure.makePath(BINDS_PATH) + TYPE_MULTIPLE_BIND); - + nodeTemplateFileNames.put(ASetMultipleBindCG.class, templateStructure.makePath(BINDS_PATH) + SET_MULT_BIND); @@ -135,12 +135,13 @@ private void initIsaNodes() + SEQ_TYPE); nodeTemplateFileNames.put(AMapMapTypeCG.class, templateStructure.TYPE_PATH - + MAP_TYPE); - + + MAP_TYPE); + nodeTemplateFileNames.put(ANotImplementedExpCG.class, templateStructure.EXP_PATH + MISC_EXP_PATH + File.separatorChar + NOT_IMPL_EXP); - - nodeTemplateFileNames.put(ALetDefExpCG.class, templateStructure) + + nodeTemplateFileNames.put(ALetDefExpCG.class, templateStructure.EXP_PATH + + MISC_EXP_PATH + File.separatorChar + LET_DEF_EXP); } } diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/LocalVar.vm b/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/LocalVar.vm new file mode 100644 index 0000000000..219e392252 --- /dev/null +++ b/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/LocalVar.vm @@ -0,0 +1 @@ +$Isa.trans($node.Pattern) : $Isa.trans($node.Type) = $Isa.trans($node.Exp) \ No newline at end of file diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Misc/LetDef.vm b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Misc/LetDef.vm index 1dffba9fbe..c44dfbf1ae 100644 --- a/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Misc/LetDef.vm +++ b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Misc/LetDef.vm @@ -1,9 +1,3 @@ -#set( $root = $Isa.trans($node.Root) ) -#set( $args = $Isa.transApplyParams($node.Args)) -#if ($Isa.isFunc($node.Root.Type) ) -${root}(${args})## -#elseif ($Isa.isRootRec($node)) -${root}[${args}]## -#else -$root<$args>## -#end \ No newline at end of file +#foreach( $def in $node.LocalDefs ) +let $Isa.trans($def) in #end +$Isa.trans($node.Exp) \ No newline at end of file From 4c28393395ad00f076fdb34ca547062f5245d3db Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 12:36:11 +0200 Subject: [PATCH 032/706] Add tests for single and multi-decl let exps in functions --- .../resources/modules/Functions/Explicit/LetExpMulti.vdmsl | 5 +++++ .../modules/Functions/Explicit/LetExpMulti.vdmsl.result | 1 + .../resources/modules/Functions/Explicit/LetExpSingle.vdmsl | 5 +++++ .../modules/Functions/Explicit/LetExpSingle.vdmsl.result | 1 + 4 files changed, 12 insertions(+) create mode 100644 core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl.result diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl new file mode 100644 index 0000000000..813f8f3c5c --- /dev/null +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl @@ -0,0 +1,5 @@ +functions + +f : int->int +f(x)== let y =1 + in x+y \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl.result new file mode 100644 index 0000000000..de136b32e2 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl.result @@ -0,0 +1 @@ +{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n is \"let y : @nat1 \u003d 1 in (^x^ + ^y^)\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl new file mode 100644 index 0000000000..fb947f460a --- /dev/null +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl @@ -0,0 +1,5 @@ +functions + +f : int->int +f(x)== let y =1,z=2 + in x+y+z \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl.result new file mode 100644 index 0000000000..67615dc8da --- /dev/null +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl.result @@ -0,0 +1 @@ +{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n is \"let y : @nat1 \u003d 1 in let z : @nat1 \u003d 2 in ((^x^ + ^y^) + ^z^)\" \n\nend","errors":false} \ No newline at end of file From 96bd5a06a7909fda063ac07766e3d2a548e5f399 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 14:09:01 +0200 Subject: [PATCH 033/706] Reorganize test folders. Expression test inputs are now encoded in text files. Issue: --- .../org/overturetool/cgisa/BinaryExpTest.java | 59 ------------------- .../overturetool/cgisa/QuantifierExpTest.java | 58 ------------------ .../test/resources/exps/binary/DivExp.vdmsl | 1 + .../resources/exps/binary/DivExp.vdmsl.result | 1 + .../resources/exps/binary/DivideExp.vdmsl | 1 + .../exps/binary/DivideExp.vdmsl.result | 1 + .../resources/exps/binary/EqualsExp.vdmsl | 1 + .../exps/binary/EqualsExp.vdmsl.result | 1 + .../test/resources/exps/binary/GTExp.vdmsl | 1 + .../resources/exps/binary/GTExp.vdmsl.result | 1 + .../test/resources/exps/binary/MinusExp.vdmsl | 1 + .../exps/binary/MinusExp.vdmsl.result | 1 + .../resources/exps/binary/NotEqualsExp.vdmsl | 1 + .../exps/binary/NotEqualsExp.vdmsl.result | 1 + .../test/resources/exps/binary/OrExp.vdmsl | 1 + .../resources/exps/binary/OrExp.vdmsl.result | 1 + .../test/resources/exps/binary/PlusExp.vdmsl | 1 + .../exps/binary/PlusExp.vdmsl.result | 1 + .../test/resources/exps/binary/TimesExp.vdmsl | 1 + .../exps/binary/TimesExp.vdmsl.result | 1 + .../exps/literal/BoolLiteralFalse.vdmsl | 1 + .../literal/BoolLiteralFalse.vdmsl.result | 1 + .../exps/literal/BoolLiteralTrue.vdmsl | 1 + .../exps/literal/BoolLiteralTrue.vdmsl.result | 1 + .../resources/exps/literal/EmptySetEnum.vdmsl | 1 + .../exps/literal/EmptySetEnum.vdmsl.result | 1 + .../resources/exps/misc/LetExpMulti.vdmsl | 1 + .../exps/misc/LetExpMulti.vdmsl.result | 1 + .../resources/exps/misc/LetExpSingle.vdmsl | 1 + .../exps/misc/LetExpSingle.vdmsl.result | 1 + .../test/resources/exps/misc/TernaryIf.vdmsl | 1 + .../exps/misc/TernaryIf.vdmsl.result | 1 + .../exps/quantifiers/ForAll1Var1Type.vdmsl | 1 + .../quantifiers/ForAll1Var1Type.vdmsl.result | 1 + .../exps/quantifiers/ForAll2Vars1Type.vdmsl | 1 + .../quantifiers/ForAll2Vars1Type.vdmsl.result | 1 + .../exps/quantifiers/ForAll2Vars2Types.vdmsl | 1 + .../ForAll2Vars2Types.vdmsl.result | 1 + .../exps/quantifiers/ForAllUsesVar.vdmsl | 1 + .../quantifiers/ForAllUsesVar.vdmsl.result | 1 + .../resources/exps/seq/SeqEnumApply.vdmsl | 1 + .../exps/seq/SeqEnumApply.vdmsl.result | 1 + .../test/resources/exps/seq/StringApply.vdmsl | 1 + .../exps/seq/StringApply.vdmsl.result | 1 + .../test/resources/exps/unary/IsIntExp.vdmsl | 1 + .../exps/unary/IsIntExp.vdmsl.result | 1 + .../test/resources/exps/unary/NotExp.vdmsl | 1 + .../resources/exps/unary/NotExp.vdmsl.result | 1 + .../resources/modules/Binds/1Var1Type.vdmsl | 2 - .../modules/Binds/1Var1Type.vdmsl.result | 1 - .../resources/modules/Binds/2Vars1Type.vdmsl | 2 - .../modules/Binds/2Vars1Type.vdmsl.result | 1 - .../resources/modules/Binds/2Vars2Types.vdmsl | 2 - .../modules/Binds/2Vars2Types.vdmsl.result | 1 - .../Functions/Explicit/LetExpMulti.vdmsl | 5 -- .../Explicit/LetExpMulti.vdmsl.result | 1 - .../Functions/Explicit/LetExpSingle.vdmsl | 5 -- .../Explicit/LetExpSingle.vdmsl.result | 1 - .../modules/Values/BoolLiteralFalse.vdmsl | 2 - .../Values/BoolLiteralFalse.vdmsl.result | 1 - .../modules/Values/BoolLiteralTrue.vdmsl | 2 - .../Values/BoolLiteralTrue.vdmsl.result | 1 - .../modules/Values/EmptySetEnum.vdmsl | 2 - .../modules/Values/EmptySetEnum.vdmsl.result | 1 - .../resources/modules/Values/EqualsExp.vdmsl | 2 - .../modules/Values/EqualsExp.vdmsl.result | 1 - .../Values/ForAllExpSingleTypeBind.vdmsl | 2 - .../ForAllExpSingleTypeBind.vdmsl.result | 1 - .../resources/modules/Values/IsIntExp.vdmsl | 2 - .../modules/Values/IsIntExp.vdmsl.result | 1 - .../resources/modules/Values/MinusExp.vdmsl | 2 - .../modules/Values/MinusExp.vdmsl.result | 1 - .../modules/Values/NotEqualsExp.vdmsl | 2 - .../modules/Values/NotEqualsExp.vdmsl.result | 1 - .../resources/modules/Values/NotExp.vdmsl | 2 - .../modules/Values/NotExp.vdmsl.result | 1 - .../test/resources/modules/Values/OrExp.vdmsl | 2 - .../modules/Values/OrExp.vdmsl.result | 1 - .../resources/modules/Values/PlusExp.vdmsl | 2 - .../modules/Values/PlusExp.vdmsl.result | 1 - .../modules/Values/SeqEnumApply.vdmsl | 2 - .../modules/Values/SeqEnumApply.vdmsl.result | 1 - .../modules/Values/StringApply.vdmsl | 2 - .../modules/Values/StringApply.vdmsl.result | 1 - .../resources/modules/Values/TernaryIf.vdmsl | 2 - .../modules/Values/TernaryIf.vdmsl.result | 1 - 86 files changed, 46 insertions(+), 180 deletions(-) delete mode 100644 core/codegen/isagen/src/test/java/org/overturetool/cgisa/BinaryExpTest.java delete mode 100644 core/codegen/isagen/src/test/java/org/overturetool/cgisa/QuantifierExpTest.java create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/DivExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/DivExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/DivideExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/DivideExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/EqualsExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/EqualsExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/GTExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/GTExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/MinusExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/MinusExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/NotEqualsExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/NotEqualsExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/OrExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/OrExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/PlusExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/PlusExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/TimesExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/TimesExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralFalse.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralFalse.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralTrue.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralTrue.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/literal/EmptySetEnum.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/literal/EmptySetEnum.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/misc/LetExpMulti.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/misc/LetExpMulti.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/misc/LetExpSingle.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/misc/LetExpSingle.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/misc/TernaryIf.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/misc/TernaryIf.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll1Var1Type.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll1Var1Type.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars1Type.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars1Type.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars2Types.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars2Types.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/quantifiers/ForAllUsesVar.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/quantifiers/ForAllUsesVar.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/seq/SeqEnumApply.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/seq/SeqEnumApply.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/seq/StringApply.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/seq/StringApply.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/unary/IsIntExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/unary/IsIntExp.vdmsl.result create mode 100644 core/codegen/isagen/src/test/resources/exps/unary/NotExp.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/unary/NotExp.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Binds/1Var1Type.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Binds/1Var1Type.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Binds/2Vars1Type.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Binds/2Vars1Type.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Binds/2Vars2Types.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Binds/2Vars2Types.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralFalse.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralFalse.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralTrue.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralTrue.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/EmptySetEnum.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/EmptySetEnum.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/EqualsExp.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/EqualsExp.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/ForAllExpSingleTypeBind.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/ForAllExpSingleTypeBind.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/IsIntExp.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/IsIntExp.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/MinusExp.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/MinusExp.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/NotEqualsExp.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/NotEqualsExp.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/NotExp.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/NotExp.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/OrExp.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/OrExp.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/PlusExp.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/PlusExp.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/SeqEnumApply.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/SeqEnumApply.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/StringApply.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/StringApply.vdmsl.result delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/TernaryIf.vdmsl delete mode 100644 core/codegen/isagen/src/test/resources/modules/Values/TernaryIf.vdmsl.result diff --git a/core/codegen/isagen/src/test/java/org/overturetool/cgisa/BinaryExpTest.java b/core/codegen/isagen/src/test/java/org/overturetool/cgisa/BinaryExpTest.java deleted file mode 100644 index 89e891eccb..0000000000 --- a/core/codegen/isagen/src/test/java/org/overturetool/cgisa/BinaryExpTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%~ - * The VDM to Isabelle Translator - * %% - * Copyright (C) 2008 - 2015 Overture - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * . - * #~% - */ -package org.overturetool.cgisa; - -import java.util.Arrays; -import java.util.Collection; - -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -@RunWith(Parameterized.class) -public class BinaryExpTest extends AbsExpTest - -{ - - String expression; - String expected; - - public BinaryExpTest(String input, String result) - { - super(input, result); - } - - @Parameters(name = "{index}: exp: {0}") - public static Collection getParams() - { - Object[] a1 = { "1+1", "(1 + 1)" }; - Object[] a2 = { "1-1", "(1 - 1)" }; - Object[] a3 = { "1*1", "(1 * 1)" }; - Object[] a4 = { "1/1", "(1 / 1)" }; - - Object[] a5 = { "1>1", "(1 > 1)" }; - Object[] a6 = { "1<>1", "(1 <> 1)" }; - - return Arrays.asList(new Object[][] { a1, a2, a3,a4,a5,a6}); - - } - -} diff --git a/core/codegen/isagen/src/test/java/org/overturetool/cgisa/QuantifierExpTest.java b/core/codegen/isagen/src/test/java/org/overturetool/cgisa/QuantifierExpTest.java deleted file mode 100644 index d46d8424db..0000000000 --- a/core/codegen/isagen/src/test/java/org/overturetool/cgisa/QuantifierExpTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%~ - * The VDM to Isabelle Translator - * %% - * Copyright (C) 2008 - 2015 Overture - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * . - * #~% - */ -package org.overturetool.cgisa; - -import java.util.Arrays; -import java.util.Collection; - -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -@RunWith(Parameterized.class) -public class QuantifierExpTest extends AbsExpTest - -{ - - String expression; - String expected; - - public QuantifierExpTest(String input, String result) - { - super(input, result); - } - - @Parameters(name = "{index}: exp: {0}") - public static Collection getParams() - { - Object[] q1 = { "forall x : int & true", "(forall x : @int & true)" }; - Object[] q2 = { "forall x,y : int & true", - "(forall x, y : @int & true)" }; - Object[] q3 = { "forall x : int, y:nat & true", - "(forall x : @int, y : @nat & true)" }; - Object[] q4 = { "forall x:int & x <> 0", "(forall x : @int & ( <> 0))" }; - - return Arrays.asList(new Object[][] { q1, q2, q3, q4 }); - - } - -} diff --git a/core/codegen/isagen/src/test/resources/exps/binary/DivExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/DivExp.vdmsl new file mode 100644 index 0000000000..f19bedf4ba --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/DivExp.vdmsl @@ -0,0 +1 @@ +1 div 1 \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/DivExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/DivExp.vdmsl.result new file mode 100644 index 0000000000..ef8f98d808 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/DivExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(1 div 1)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/DivideExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/DivideExp.vdmsl new file mode 100644 index 0000000000..4dc2ba5b11 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/DivideExp.vdmsl @@ -0,0 +1 @@ +1/1 \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/DivideExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/DivideExp.vdmsl.result new file mode 100644 index 0000000000..02b480eb30 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/DivideExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(1 / 1)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/EqualsExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/EqualsExp.vdmsl new file mode 100644 index 0000000000..1388815547 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/EqualsExp.vdmsl @@ -0,0 +1 @@ +1=1 diff --git a/core/codegen/isagen/src/test/resources/exps/binary/EqualsExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/EqualsExp.vdmsl.result new file mode 100644 index 0000000000..886e9297f8 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/EqualsExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(1 \u003d 1)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/GTExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/GTExp.vdmsl new file mode 100644 index 0000000000..6ec0cbf95a --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/GTExp.vdmsl @@ -0,0 +1 @@ +1>1 \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/GTExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/GTExp.vdmsl.result new file mode 100644 index 0000000000..9da4069a75 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/GTExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(1 \u003e 1)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/MinusExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/MinusExp.vdmsl new file mode 100644 index 0000000000..5a566dd762 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/MinusExp.vdmsl @@ -0,0 +1 @@ +1-1 diff --git a/core/codegen/isagen/src/test/resources/exps/binary/MinusExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/MinusExp.vdmsl.result new file mode 100644 index 0000000000..c78595beea --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/MinusExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(1 - 1)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/NotEqualsExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/NotEqualsExp.vdmsl new file mode 100644 index 0000000000..a9ccf4cf91 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/NotEqualsExp.vdmsl @@ -0,0 +1 @@ +true <> false diff --git a/core/codegen/isagen/src/test/resources/exps/binary/NotEqualsExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/NotEqualsExp.vdmsl.result new file mode 100644 index 0000000000..1cfa0c4a27 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/NotEqualsExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(true \u003c\u003e false)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/OrExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/OrExp.vdmsl new file mode 100644 index 0000000000..62c89b1996 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/OrExp.vdmsl @@ -0,0 +1 @@ +true or false \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/OrExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/OrExp.vdmsl.result new file mode 100644 index 0000000000..de351e18c3 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/OrExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(true or false)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/PlusExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/PlusExp.vdmsl new file mode 100644 index 0000000000..c040fa67d3 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/PlusExp.vdmsl @@ -0,0 +1 @@ +1+1 diff --git a/core/codegen/isagen/src/test/resources/exps/binary/PlusExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/PlusExp.vdmsl.result new file mode 100644 index 0000000000..cf70624995 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/PlusExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(1 + 1)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/TimesExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/TimesExp.vdmsl new file mode 100644 index 0000000000..4f1d862db2 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/TimesExp.vdmsl @@ -0,0 +1 @@ +1*1 \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/TimesExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/TimesExp.vdmsl.result new file mode 100644 index 0000000000..3c75f8cbde --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/TimesExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(1 * 1)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralFalse.vdmsl b/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralFalse.vdmsl new file mode 100644 index 0000000000..c508d5366f --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralFalse.vdmsl @@ -0,0 +1 @@ +false diff --git a/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralFalse.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralFalse.vdmsl.result new file mode 100644 index 0000000000..36a3f0a333 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralFalse.vdmsl.result @@ -0,0 +1 @@ +{"translation":"false","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralTrue.vdmsl b/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralTrue.vdmsl new file mode 100644 index 0000000000..27ba77ddaf --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralTrue.vdmsl @@ -0,0 +1 @@ +true diff --git a/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralTrue.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralTrue.vdmsl.result new file mode 100644 index 0000000000..5c6702dfd7 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/literal/BoolLiteralTrue.vdmsl.result @@ -0,0 +1 @@ +{"translation":"true","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/literal/EmptySetEnum.vdmsl b/core/codegen/isagen/src/test/resources/exps/literal/EmptySetEnum.vdmsl new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/literal/EmptySetEnum.vdmsl @@ -0,0 +1 @@ +{} diff --git a/core/codegen/isagen/src/test/resources/exps/literal/EmptySetEnum.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/literal/EmptySetEnum.vdmsl.result new file mode 100644 index 0000000000..3d2cb082f5 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/literal/EmptySetEnum.vdmsl.result @@ -0,0 +1 @@ +{"translation":"{}","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/misc/LetExpMulti.vdmsl b/core/codegen/isagen/src/test/resources/exps/misc/LetExpMulti.vdmsl new file mode 100644 index 0000000000..96bbf28c9f --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/misc/LetExpMulti.vdmsl @@ -0,0 +1 @@ +let y =1,z=2 in y+z diff --git a/core/codegen/isagen/src/test/resources/exps/misc/LetExpMulti.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/misc/LetExpMulti.vdmsl.result new file mode 100644 index 0000000000..638c0f0c93 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/misc/LetExpMulti.vdmsl.result @@ -0,0 +1 @@ +{"translation":"let y : @nat1 \u003d 1 in let z : @nat1 \u003d 2 in (\u003cy\u003e + \u003cz\u003e)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/misc/LetExpSingle.vdmsl b/core/codegen/isagen/src/test/resources/exps/misc/LetExpSingle.vdmsl new file mode 100644 index 0000000000..c107f90c3f --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/misc/LetExpSingle.vdmsl @@ -0,0 +1 @@ +let y =1 in 1+y \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/misc/LetExpSingle.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/misc/LetExpSingle.vdmsl.result new file mode 100644 index 0000000000..330e2e88a5 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/misc/LetExpSingle.vdmsl.result @@ -0,0 +1 @@ +{"translation":"let y : @nat1 \u003d 1 in (1 + \u003cy\u003e)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/misc/TernaryIf.vdmsl b/core/codegen/isagen/src/test/resources/exps/misc/TernaryIf.vdmsl new file mode 100644 index 0000000000..a12f6f484a --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/misc/TernaryIf.vdmsl @@ -0,0 +1 @@ +if true then 1 else 2; diff --git a/core/codegen/isagen/src/test/resources/exps/misc/TernaryIf.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/misc/TernaryIf.vdmsl.result new file mode 100644 index 0000000000..aa4e40c754 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/misc/TernaryIf.vdmsl.result @@ -0,0 +1 @@ +{"translation":"if true then 1 else 2","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll1Var1Type.vdmsl b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll1Var1Type.vdmsl new file mode 100644 index 0000000000..6d9d702a78 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll1Var1Type.vdmsl @@ -0,0 +1 @@ +forall x : int & true \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll1Var1Type.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll1Var1Type.vdmsl.result new file mode 100644 index 0000000000..c3c0f29176 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll1Var1Type.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(forall x : @int \u0026 true)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars1Type.vdmsl b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars1Type.vdmsl new file mode 100644 index 0000000000..a43df80193 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars1Type.vdmsl @@ -0,0 +1 @@ +forall x,y : int & true \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars1Type.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars1Type.vdmsl.result new file mode 100644 index 0000000000..4bae67bda5 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars1Type.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(forall x, y : @int \u0026 true)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars2Types.vdmsl b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars2Types.vdmsl new file mode 100644 index 0000000000..3b414e7d29 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars2Types.vdmsl @@ -0,0 +1 @@ +forall x : int, y : nat & true \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars2Types.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars2Types.vdmsl.result new file mode 100644 index 0000000000..65a537f0cd --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAll2Vars2Types.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(forall x : @int, y : @nat \u0026 true)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAllUsesVar.vdmsl b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAllUsesVar.vdmsl new file mode 100644 index 0000000000..94f83fb444 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAllUsesVar.vdmsl @@ -0,0 +1 @@ +forall x:int & x <> 0 \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAllUsesVar.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAllUsesVar.vdmsl.result new file mode 100644 index 0000000000..cce28a7498 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/quantifiers/ForAllUsesVar.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(forall x : @int \u0026 (\u003cx\u003e \u003c\u003e 0))","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/seq/SeqEnumApply.vdmsl b/core/codegen/isagen/src/test/resources/exps/seq/SeqEnumApply.vdmsl new file mode 100644 index 0000000000..d2b00a92cc --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/seq/SeqEnumApply.vdmsl @@ -0,0 +1 @@ +[1,2,3](1); diff --git a/core/codegen/isagen/src/test/resources/exps/seq/SeqEnumApply.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/seq/SeqEnumApply.vdmsl.result new file mode 100644 index 0000000000..68370ae903 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/seq/SeqEnumApply.vdmsl.result @@ -0,0 +1 @@ +{"translation":"[1, 2, 3]\u003c1\u003e","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/seq/StringApply.vdmsl b/core/codegen/isagen/src/test/resources/exps/seq/StringApply.vdmsl new file mode 100644 index 0000000000..9aa16258f9 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/seq/StringApply.vdmsl @@ -0,0 +1 @@ +"abc"(1); diff --git a/core/codegen/isagen/src/test/resources/exps/seq/StringApply.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/seq/StringApply.vdmsl.result new file mode 100644 index 0000000000..819a8a3bbe --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/seq/StringApply.vdmsl.result @@ -0,0 +1 @@ +{"translation":"\u0027\u0027abc\u0027\u0027\u003c1\u003e","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/unary/IsIntExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/unary/IsIntExp.vdmsl new file mode 100644 index 0000000000..3d6ab8dbeb --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/unary/IsIntExp.vdmsl @@ -0,0 +1 @@ +is_(1,int) diff --git a/core/codegen/isagen/src/test/resources/exps/unary/IsIntExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/unary/IsIntExp.vdmsl.result new file mode 100644 index 0000000000..579a3ceff7 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/unary/IsIntExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"(1 hasType @int)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/unary/NotExp.vdmsl b/core/codegen/isagen/src/test/resources/exps/unary/NotExp.vdmsl new file mode 100644 index 0000000000..5455d56b44 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/unary/NotExp.vdmsl @@ -0,0 +1 @@ +not true diff --git a/core/codegen/isagen/src/test/resources/exps/unary/NotExp.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/unary/NotExp.vdmsl.result new file mode 100644 index 0000000000..5a3edfa339 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/unary/NotExp.vdmsl.result @@ -0,0 +1 @@ +{"translation":"not (true)","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Binds/1Var1Type.vdmsl b/core/codegen/isagen/src/test/resources/modules/Binds/1Var1Type.vdmsl deleted file mode 100644 index 7a770fdec5..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Binds/1Var1Type.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = forall x : int & true \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Binds/1Var1Type.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Binds/1Var1Type.vdmsl.result deleted file mode 100644 index 0fa9aba9e6..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Binds/1Var1Type.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(forall x : @int \u0026 true) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Binds/2Vars1Type.vdmsl b/core/codegen/isagen/src/test/resources/modules/Binds/2Vars1Type.vdmsl deleted file mode 100644 index 8e0ae5c1b1..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Binds/2Vars1Type.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = forall x,y : int & true \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Binds/2Vars1Type.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Binds/2Vars1Type.vdmsl.result deleted file mode 100644 index a34fb3a580..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Binds/2Vars1Type.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(forall x, y : @int \u0026 true) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Binds/2Vars2Types.vdmsl b/core/codegen/isagen/src/test/resources/modules/Binds/2Vars2Types.vdmsl deleted file mode 100644 index fe4e288f0b..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Binds/2Vars2Types.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = forall x : int, y : nat & true \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Binds/2Vars2Types.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Binds/2Vars2Types.vdmsl.result deleted file mode 100644 index 65f8ca69f6..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Binds/2Vars2Types.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(forall x : @int, y : @nat \u0026 true) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl deleted file mode 100644 index 813f8f3c5c..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl +++ /dev/null @@ -1,5 +0,0 @@ -functions - -f : int->int -f(x)== let y =1 - in x+y \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl.result deleted file mode 100644 index de136b32e2..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpMulti.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n is \"let y : @nat1 \u003d 1 in (^x^ + ^y^)\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl deleted file mode 100644 index fb947f460a..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl +++ /dev/null @@ -1,5 +0,0 @@ -functions - -f : int->int -f(x)== let y =1,z=2 - in x+y+z \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl.result deleted file mode 100644 index 67615dc8da..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/LetExpSingle.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n is \"let y : @nat1 \u003d 1 in let z : @nat1 \u003d 2 in ((^x^ + ^y^) + ^z^)\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralFalse.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralFalse.vdmsl deleted file mode 100644 index 3d818de16b..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralFalse.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = false; diff --git a/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralFalse.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralFalse.vdmsl.result deleted file mode 100644 index c7d65e1c94..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralFalse.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|false : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralTrue.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralTrue.vdmsl deleted file mode 100644 index 425f0c7551..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralTrue.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = true; diff --git a/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralTrue.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralTrue.vdmsl.result deleted file mode 100644 index 0d35fc8678..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/BoolLiteralTrue.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|true : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/EmptySetEnum.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/EmptySetEnum.vdmsl deleted file mode 100644 index 1ce79a8df9..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/EmptySetEnum.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = {}; diff --git a/core/codegen/isagen/src/test/resources/modules/Values/EmptySetEnum.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/EmptySetEnum.vdmsl.result deleted file mode 100644 index a5bc64fd46..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/EmptySetEnum.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|{} : @set of ()|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/EqualsExp.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/EqualsExp.vdmsl deleted file mode 100644 index cb34b541fc..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/EqualsExp.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = 1=1; diff --git a/core/codegen/isagen/src/test/resources/modules/Values/EqualsExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/EqualsExp.vdmsl.result deleted file mode 100644 index 011471cfcf..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/EqualsExp.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(1 \u003d 1) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/ForAllExpSingleTypeBind.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/ForAllExpSingleTypeBind.vdmsl deleted file mode 100644 index 729ce2c1c6..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/ForAllExpSingleTypeBind.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = forall x : int & true diff --git a/core/codegen/isagen/src/test/resources/modules/Values/ForAllExpSingleTypeBind.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/ForAllExpSingleTypeBind.vdmsl.result deleted file mode 100644 index 0fa9aba9e6..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/ForAllExpSingleTypeBind.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(forall x : @int \u0026 true) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/IsIntExp.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/IsIntExp.vdmsl deleted file mode 100644 index 8e035f9685..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/IsIntExp.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = is_(1,int) diff --git a/core/codegen/isagen/src/test/resources/modules/Values/IsIntExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/IsIntExp.vdmsl.result deleted file mode 100644 index 6d36faa465..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/IsIntExp.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(1 hasType @int) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/MinusExp.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/MinusExp.vdmsl deleted file mode 100644 index 360588c6d6..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/MinusExp.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = 1-1; diff --git a/core/codegen/isagen/src/test/resources/modules/Values/MinusExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/MinusExp.vdmsl.result deleted file mode 100644 index 25eba692d5..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/MinusExp.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(1 - 1) : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/NotEqualsExp.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/NotEqualsExp.vdmsl deleted file mode 100644 index 521ee90483..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/NotEqualsExp.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = true <> false diff --git a/core/codegen/isagen/src/test/resources/modules/Values/NotEqualsExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/NotEqualsExp.vdmsl.result deleted file mode 100644 index c3802d32f6..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/NotEqualsExp.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(true \u003c\u003e false) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/NotExp.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/NotExp.vdmsl deleted file mode 100644 index cd6d657c06..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/NotExp.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = not true diff --git a/core/codegen/isagen/src/test/resources/modules/Values/NotExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/NotExp.vdmsl.result deleted file mode 100644 index adfed20873..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/NotExp.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|not (true) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/OrExp.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/OrExp.vdmsl deleted file mode 100644 index b722984308..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/OrExp.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = true or false; diff --git a/core/codegen/isagen/src/test/resources/modules/Values/OrExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/OrExp.vdmsl.result deleted file mode 100644 index 370993f262..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/OrExp.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(true or false) : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/PlusExp.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/PlusExp.vdmsl deleted file mode 100644 index 499947fb00..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/PlusExp.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = 1+1; diff --git a/core/codegen/isagen/src/test/resources/modules/Values/PlusExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/PlusExp.vdmsl.result deleted file mode 100644 index 436ab021cc..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/PlusExp.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|(1 + 1) : @nat1|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/SeqEnumApply.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/SeqEnumApply.vdmsl deleted file mode 100644 index 1c7780e9d5..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/SeqEnumApply.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = [1,2,3](1); diff --git a/core/codegen/isagen/src/test/resources/modules/Values/SeqEnumApply.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/SeqEnumApply.vdmsl.result deleted file mode 100644 index 02fd7ee31c..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/SeqEnumApply.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|[1, 2, 3]\u003c1\u003e : @nat1|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/StringApply.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/StringApply.vdmsl deleted file mode 100644 index a66c60d3fe..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/StringApply.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = "abc"(1); diff --git a/core/codegen/isagen/src/test/resources/modules/Values/StringApply.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/StringApply.vdmsl.result deleted file mode 100644 index 45d2932a00..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/StringApply.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|\u0027\u0027abc\u0027\u0027\u003c1\u003e : @char|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/TernaryIf.vdmsl b/core/codegen/isagen/src/test/resources/modules/Values/TernaryIf.vdmsl deleted file mode 100644 index b32400be31..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/TernaryIf.vdmsl +++ /dev/null @@ -1,2 +0,0 @@ -values -x = if true then 1 else 2; diff --git a/core/codegen/isagen/src/test/resources/modules/Values/TernaryIf.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/TernaryIf.vdmsl.result deleted file mode 100644 index 8dc4a2f6ff..0000000000 --- a/core/codegen/isagen/src/test/resources/modules/Values/TernaryIf.vdmsl.result +++ /dev/null @@ -1 +0,0 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|if true then 1 else 2 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file From 2f91bc70a97599a8304e6cc4c4d6459df0b65086 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 14:10:07 +0200 Subject: [PATCH 034/706] Add Exp Test using new input system --- .../overturetool/cgisa/CgIsaTestResult.java | 23 +++- .../overturetool/cgisa/IsaGenFileExpTest.java | 124 ++++++++++++++++++ 2 files changed, 140 insertions(+), 7 deletions(-) create mode 100644 core/codegen/isagen/src/test/java/org/overturetool/cgisa/IsaGenFileExpTest.java diff --git a/core/codegen/isagen/src/test/java/org/overturetool/cgisa/CgIsaTestResult.java b/core/codegen/isagen/src/test/java/org/overturetool/cgisa/CgIsaTestResult.java index 8b9e8fc07b..b5206effe6 100644 --- a/core/codegen/isagen/src/test/java/org/overturetool/cgisa/CgIsaTestResult.java +++ b/core/codegen/isagen/src/test/java/org/overturetool/cgisa/CgIsaTestResult.java @@ -40,8 +40,6 @@ private CgIsaTestResult(String translation, boolean errors) this.translation = translation; this.errors = errors; } - - @Override public String toString() @@ -82,17 +80,28 @@ public boolean equals(Object obj) return true; } - public boolean compare(CgIsaTestResult other){ - if (errors != other.errors){ + public boolean compare(CgIsaTestResult other) + { + if (errors != other.errors) + { return false; } - if (!translation.replaceAll("\\s", "").equals(other.translation.replaceAll("\\s", ""))){ + if (!translation.replaceAll("\\s", "").equals(other.translation.replaceAll("\\s", ""))) + { return false; } - + return true; } - + + public static CgIsaTestResult convert(GeneratedModule result) + { + String content = result.getContent(); + boolean err = result.hasMergeErrors() || !result.canBeGenerated()|| result.hasUnsupportedIrNodes(); + + return new CgIsaTestResult(content, err); + } + public static CgIsaTestResult convert(List result) { StringBuilder trans = new StringBuilder(); diff --git a/core/codegen/isagen/src/test/java/org/overturetool/cgisa/IsaGenFileExpTest.java b/core/codegen/isagen/src/test/java/org/overturetool/cgisa/IsaGenFileExpTest.java new file mode 100644 index 0000000000..c201587513 --- /dev/null +++ b/core/codegen/isagen/src/test/java/org/overturetool/cgisa/IsaGenFileExpTest.java @@ -0,0 +1,124 @@ +/* + * #%~ + * VDM to Isabelle Translation + * %% + * Copyright (C) 2008 - 2015 Overture + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * . + * #~% + */ +package org.overturetool.cgisa; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.Collection; + +import org.apache.commons.io.FileUtils; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.ast.analysis.AnalysisException; +import org.overture.ast.expressions.PExp; +import org.overture.codegen.utils.GeneratedModule; +import org.overture.core.tests.ParamFineGrainTest; +import org.overture.core.tests.ParseTcFacade; +import org.overture.core.tests.PathsProvider; + +import com.google.gson.reflect.TypeToken; + +/** + * Main parameterized test class. Runs tests on modules with minimal definitions to exercise the translation with a + * single construct at a time. + * + * @author ldc + */ +@RunWith(Parameterized.class) +public class IsaGenFileExpTest extends ParamFineGrainTest +{ + + public IsaGenFileExpTest(String nameParameter, String inputParameter, + String resultParameter) + { + super(nameParameter, inputParameter, resultParameter); + } + + private static final String UPDATE = "tests.update.isagen"; + private static final String EXPS_ROOT = "src/test/resources/exps"; + + @Parameters(name = "{index} : {0}") + public static Collection testData() + { + return PathsProvider.computePaths(EXPS_ROOT); + } + + @Override + public Type getResultType() + { + Type resultType = new TypeToken() + { + }.getType(); + return resultType; + } + + @Override + protected String getUpdatePropertyString() + { + return UPDATE; + } + + @Override + public void compareResults(CgIsaTestResult actual, CgIsaTestResult expected) + { + assertTrue("\n --- Expected: ---\n" + expected.translation + + "\n --- Got: ---\n" + actual.translation, expected.compare(actual)); + } + + @Override + public CgIsaTestResult processSource() + { + IsaGen gen = new IsaGen(); + GeneratedModule result = null; + try + { + String exp = FileUtils.readFileToString(new File(modelPath)); + + PExp pexp = ParseTcFacade.parseTcExpressionString(exp); + + result = gen.generateIsabelleSyntax(pexp); + if (!result.canBeGenerated()) + { + StringBuilder sb = new StringBuilder(); + sb.append(result.getMergeErrors()); + sb.append(result.getUnsupportedInIr()); + sb.append(result.getUnsupportedInTargLang()); + fail(sb.toString()); + } + } catch (AnalysisException + | org.overture.codegen.cgast.analysis.AnalysisException + | IOException e) + { + fail("Could not process test file " + testName + "Reason: " + + e.getMessage()); + return null; + } + + return CgIsaTestResult.convert(result); + } + +} From 493b9c224c4c4508e5bd3237fd33fbe4caef408e Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 14:10:37 +0200 Subject: [PATCH 035/706] Add tempaltes for div and subset Issue: --- .../cgisa/IsaTemplateManager.java | 39 +++++++++++-------- .../Expressions/Binary/Numeric/Div.vm | 1 + .../IsaTemplates/Expressions/Binary/Subset | 1 + 3 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Numeric/Div.vm create mode 100644 core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Subset diff --git a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java index 5a65aae325..f85f12d6b4 100644 --- a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java +++ b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java @@ -33,6 +33,7 @@ import org.overture.codegen.cgast.expressions.ACharLiteralExpCG; import org.overture.codegen.cgast.expressions.AExplicitVarExpCG; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; +import org.overture.codegen.cgast.expressions.AIntDivNumericBinaryExpCG; import org.overture.codegen.cgast.expressions.AIntLiteralExpCG; import org.overture.codegen.cgast.expressions.ALetDefExpCG; import org.overture.codegen.cgast.expressions.ANotImplementedExpCG; @@ -49,11 +50,11 @@ public class IsaTemplateManager extends TemplateManager { - private static final String MISC_EXP_PATH = "Misc"; - private static final String LITERAL_EXP_PATH = "Literal"; - private static final String BINDS_PATH = "Binds"; + private static final String MISC_EXP_FOLDER = "Misc"; + private static final String LITERAL_EXP_FOLDER = "Literal"; + private static final String BINDS_FOLDER = "Binds"; - private static final String FUNC_TEMPLATE = "Function"; + private static final String FUNCTION = "Function"; private static final String FORMAL_PARAM = "FormalParam"; private static final String MUT_REC = "MutRec"; private static final String MODULE_DECL = "Module"; @@ -73,6 +74,7 @@ public class IsaTemplateManager extends TemplateManager private static final String NOT_IMPL_EXP = "NotImplemented"; private static final String SET_MULT_BIND = "SetMultiple"; private static final String LET_DEF_EXP = "LetDef"; + private static final String DIV_EXP = "Div"; public IsaTemplateManager(TemplateStructure templateStructure, Class classRef) @@ -84,7 +86,7 @@ public IsaTemplateManager(TemplateStructure templateStructure, private void initIsaNodes() { nodeTemplateFileNames.put(AFuncDeclCG.class, templateStructure.DECL_PATH - + FUNC_TEMPLATE); + + FUNCTION); nodeTemplateFileNames.put(AFormalParamLocalParamCG.class, templateStructure.LOCAL_DECLS_PATH + FORMAL_PARAM); @@ -96,34 +98,34 @@ private void initIsaNodes() + MODULE_DECL); nodeTemplateFileNames.put(AApplyExpCG.class, templateStructure.EXP_PATH - + MISC_EXP_PATH + File.separatorChar + APPLY); + + MISC_EXP_FOLDER + File.separatorChar + APPLY); nodeTemplateFileNames.put(AIdentifierVarExpCG.class, templateStructure.EXP_PATH - + MISC_EXP_PATH + File.separatorChar + VAR); + + MISC_EXP_FOLDER + File.separatorChar + VAR); nodeTemplateFileNames.put(ATernaryIfExpCG.class, templateStructure.EXP_PATH - + MISC_EXP_PATH + File.separatorChar + TERNARY); + + MISC_EXP_FOLDER + File.separatorChar + TERNARY); nodeTemplateFileNames.put(ABoolLiteralExpCG.class, templateStructure.EXP_PATH - + LITERAL_EXP_PATH + File.separatorChar + BOOL_LIT); + + LITERAL_EXP_FOLDER + File.separatorChar + BOOL_LIT); nodeTemplateFileNames.put(ACharLiteralExpCG.class, templateStructure.EXP_PATH - + LITERAL_EXP_PATH + File.separatorChar + CHAR_LIT); + + LITERAL_EXP_FOLDER + File.separatorChar + CHAR_LIT); nodeTemplateFileNames.put(AIntLiteralExpCG.class, templateStructure.EXP_PATH - + LITERAL_EXP_PATH + File.separatorChar + INT_LIT); + + LITERAL_EXP_FOLDER + File.separatorChar + INT_LIT); nodeTemplateFileNames.put(ARealLiteralExpCG.class, templateStructure.EXP_PATH - + LITERAL_EXP_PATH + File.separatorChar + REAL_LIT); + + LITERAL_EXP_FOLDER + File.separatorChar + REAL_LIT); - nodeTemplateFileNames.put(ATypeMultipleBindCG.class, templateStructure.makePath(BINDS_PATH) + nodeTemplateFileNames.put(ATypeMultipleBindCG.class, templateStructure.makePath(BINDS_FOLDER) + TYPE_MULTIPLE_BIND); - nodeTemplateFileNames.put(ASetMultipleBindCG.class, templateStructure.makePath(BINDS_PATH) + nodeTemplateFileNames.put(ASetMultipleBindCG.class, templateStructure.makePath(BINDS_FOLDER) + SET_MULT_BIND); nodeTemplateFileNames.put(AExplicitVarExpCG.class, templateStructure.EXP_PATH - + MISC_EXP_PATH + File.separatorChar + EXPLICIT_VAR); + + MISC_EXP_FOLDER + File.separatorChar + EXPLICIT_VAR); nodeTemplateFileNames.put(ANamedTypeDeclCG.class, templateStructure.DECL_PATH + NAMED_TYPE); @@ -138,10 +140,13 @@ private void initIsaNodes() + MAP_TYPE); nodeTemplateFileNames.put(ANotImplementedExpCG.class, templateStructure.EXP_PATH - + MISC_EXP_PATH + File.separatorChar + NOT_IMPL_EXP); + + MISC_EXP_FOLDER + File.separatorChar + NOT_IMPL_EXP); nodeTemplateFileNames.put(ALetDefExpCG.class, templateStructure.EXP_PATH - + MISC_EXP_PATH + File.separatorChar + LET_DEF_EXP); + + MISC_EXP_FOLDER + File.separatorChar + LET_DEF_EXP); + + nodeTemplateFileNames.put(AIntDivNumericBinaryExpCG.class, templateStructure.NUMERIC_BINARY_EXP_PATH + + File.separatorChar + DIV_EXP); } } diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Numeric/Div.vm b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Numeric/Div.vm new file mode 100644 index 0000000000..565065a0d7 --- /dev/null +++ b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Numeric/Div.vm @@ -0,0 +1 @@ +($Isa.trans($node.Left) div $Isa.trans($node.Right)) \ No newline at end of file diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Subset b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Subset new file mode 100644 index 0000000000..8a2554bf4c --- /dev/null +++ b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Subset @@ -0,0 +1 @@ +($Isa.trans($node.Left) subset $Isa.trans($node.Right)) \ No newline at end of file From b24f1c605510742539a4e8f7a8b626b3fcf62d5e Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 14:16:12 +0200 Subject: [PATCH 036/706] Fix name and extension of subset template Issue: --- .../IsaTemplates/Expressions/Binary/{Subset => SetSubset.vm} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/{Subset => SetSubset.vm} (100%) diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Subset b/core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/SetSubset.vm similarity index 100% rename from core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/Subset rename to core/codegen/isagen/src/main/resources/IsaTemplates/Expressions/Binary/SetSubset.vm From b639d96297f23656a332008f33df0f73b12e604c Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 14:16:48 +0200 Subject: [PATCH 037/706] Add test case for subset expression. Issue: --- core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl | 1 + .../isagen/src/test/resources/exps/binary/Subset.vdmsl.result | 1 + 2 files changed, 2 insertions(+) create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl.result diff --git a/core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl b/core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl new file mode 100644 index 0000000000..8f0abd082e --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl @@ -0,0 +1 @@ +{} subset {} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl.result b/core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl.result new file mode 100644 index 0000000000..b74ec12197 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/exps/binary/Subset.vdmsl.result @@ -0,0 +1 @@ +{"translation":"({} subset {})","errors":false} \ No newline at end of file From 089695482a7d8be705726df3986100c2bf860bee Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 16:20:38 +0200 Subject: [PATCH 038/706] Add new transformation for state initializer --- .../java/org/overturetool/cgisa/IsaGen.java | 7 ++- .../cgisa/transformations/StateInit.java | 55 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 core/codegen/isagen/src/main/java/org/overturetool/cgisa/transformations/StateInit.java diff --git a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaGen.java b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaGen.java index abf91f52cd..21f02f3e9f 100644 --- a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaGen.java +++ b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaGen.java @@ -45,6 +45,7 @@ import org.overture.codegen.utils.GeneratedModule; import org.overturetool.cgisa.transformations.GroupMutRecs; import org.overturetool.cgisa.transformations.SortDependencies; +import org.overturetool.cgisa.transformations.StateInit; /** * Main facade class for VDM 2 Isabelle CG @@ -152,7 +153,11 @@ public List generateIsabelleSyntax(List ast) // Apply transformations for (IRStatus status : statuses) { - // first, transform away any recursion cycles + // make init expression an op + StateInit stateInit = new StateInit(getInfo()); + generator.applyPartialTransformation(status, stateInit); + + // transform away any recursion cycles GroupMutRecs groupMR = new GroupMutRecs(); generator.applyTotalTransformation(status, groupMR); diff --git a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/transformations/StateInit.java b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/transformations/StateInit.java new file mode 100644 index 0000000000..bbe742d874 --- /dev/null +++ b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/transformations/StateInit.java @@ -0,0 +1,55 @@ +package org.overturetool.cgisa.transformations; + +import org.overture.ast.expressions.AEqualsBinaryExp; +import org.overture.codegen.cgast.SExpCG; +import org.overture.codegen.cgast.analysis.AnalysisException; +import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; +import org.overture.codegen.cgast.declarations.AMethodDeclCG; +import org.overture.codegen.cgast.declarations.AModuleDeclCG; +import org.overture.codegen.cgast.declarations.AStateDeclCG; +import org.overture.codegen.cgast.expressions.AEqualsBinaryExpCG; +import org.overture.codegen.cgast.statements.AAtomicStmCG; +import org.overture.codegen.cgast.statements.AReturnStmCG; +import org.overture.codegen.ir.IRInfo; + +public class StateInit extends DepthFirstAnalysisAdaptor +{ + private IRInfo info; + + public StateInit(IRInfo info) + { + this.info = info; + } + + @Override + public void caseAStateDeclCG(AStateDeclCG node) throws AnalysisException + { + if (node.getInitDecl() != null) + { + AMethodDeclCG initOp; + if (node.getExecutable()) + { + initOp = makeExecutableInit(node); + } else + { + initOp = info.getDeclAssistant().funcToMethod(node.getInitDecl()); + } + + AModuleDeclCG module = node.getAncestor(AModuleDeclCG.class); + module.getDecls().add(initOp); + node.setInitDecl(null); + } + } + + private AMethodDeclCG makeExecutableInit(AStateDeclCG node) + { + AMethodDeclCG meth = info.getDeclAssistant().funcToMethod(node.getInitDecl()); + AReturnStmCG ret = new AReturnStmCG(); + + AEqualsBinaryExpCG initExp = (AEqualsBinaryExpCG) node.getInitExp(); + ret.setExp(initExp.getRight().clone()); + + meth.setBody(ret); + return meth; + } +} From 012d951e584dc8aec4dcd65d885bdc698db0aa93 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 16:20:53 +0200 Subject: [PATCH 039/706] Ongoing work on translating state --- .../cgisa/IsaTemplateManager.java | 5 +++++ .../overturetool/cgisa/IsaTranslations.java | 12 +++++++++--- .../IsaTemplates/Declarations/Method.vm | 19 +++++++++++++++++++ .../IsaTemplates/Declarations/State.vm | 3 +++ .../resources/modules/State/EqualsInit.vdmsl | 4 ++++ .../modules/State/PredicateInit.vdmsl | 4 ++++ 6 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/Method.vm create mode 100644 core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/State.vm create mode 100644 core/codegen/isagen/src/test/resources/modules/State/EqualsInit.vdmsl create mode 100644 core/codegen/isagen/src/test/resources/modules/State/PredicateInit.vdmsl diff --git a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java index f85f12d6b4..b8e2417e7e 100644 --- a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java +++ b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTemplateManager.java @@ -28,6 +28,7 @@ import org.overture.codegen.cgast.declarations.AFuncDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; import org.overture.codegen.cgast.declarations.ANamedTypeDeclCG; +import org.overture.codegen.cgast.declarations.AStateDeclCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; import org.overture.codegen.cgast.expressions.ABoolLiteralExpCG; import org.overture.codegen.cgast.expressions.ACharLiteralExpCG; @@ -75,6 +76,7 @@ public class IsaTemplateManager extends TemplateManager private static final String SET_MULT_BIND = "SetMultiple"; private static final String LET_DEF_EXP = "LetDef"; private static final String DIV_EXP = "Div"; + private static final String STATE_DECL = "State"; public IsaTemplateManager(TemplateStructure templateStructure, Class classRef) @@ -148,5 +150,8 @@ private void initIsaNodes() nodeTemplateFileNames.put(AIntDivNumericBinaryExpCG.class, templateStructure.NUMERIC_BINARY_EXP_PATH + File.separatorChar + DIV_EXP); + nodeTemplateFileNames.put(AStateDeclCG.class, templateStructure.DECL_PATH + + File.separator + STATE_DECL); + } } diff --git a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTranslations.java b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTranslations.java index ecc83639f5..96d648d368 100644 --- a/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTranslations.java +++ b/core/codegen/isagen/src/main/java/org/overturetool/cgisa/IsaTranslations.java @@ -38,6 +38,8 @@ import org.overture.codegen.cgast.declarations.ARecordDeclCG; import org.overture.codegen.cgast.declarations.ATypeDeclCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; +import org.overture.codegen.cgast.types.AMethodTypeCG; +import org.overture.codegen.cgast.types.AVoidTypeCG; import org.overture.codegen.ir.SourceNode; import org.overture.codegen.merging.MergeVisitor; import org.overture.codegen.merging.TemplateCallable; @@ -157,7 +159,6 @@ public String rec2Tuple(ARecordDeclCG record) throws AnalysisException return sb.toString(); } - // Hacks - translations that manipulate the tree in grostesque way due to // issues with the IR // FIXME Unhack result name extraction for implicit functions @@ -254,13 +255,18 @@ public String filter(AFieldDeclCG field) throws AnalysisException } // Checks + public boolean hasReturn(AMethodTypeCG node) + { + return !(node.getResult() instanceof AVoidTypeCG); + } public boolean isRoot(INode node) { return isaUtils.isRoot(node); } - - public boolean isRootRec(AApplyExpCG node){ + + public boolean isRootRec(AApplyExpCG node) + { return isaUtils.isRootRec(node); } diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/Method.vm b/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/Method.vm new file mode 100644 index 0000000000..2260e76789 --- /dev/null +++ b/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/Method.vm @@ -0,0 +1,19 @@ +#if ($node.Implicit) +vdmiop0 $Isa.norm($node.Name) +#if (!$node.FormalParams.isEmpty()) + inp $Isa.transTypeParams($node.FormalParams) +#end +#if ($Isa.hasReturn($node.MethodType)) + out $Isa.hackResultName($node) :: "$Isa.trans($node.MethodType.Result)" +#end +post "$Isa.trans($node.Post)" +#else +vemeop $Isa.norm($node.Name) +#if (!$node.FormalParams.isEmpty()) + inp $Isa.transTypeParams($node.FormalParams) +#end +#if ($Isa.hasReturn($node.MethodType)) + out "$Isa.trans($node.MethodType.Result)" +#end +is "body statement..." +#end \ No newline at end of file diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/State.vm b/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/State.vm new file mode 100644 index 0000000000..afc1f3ab5d --- /dev/null +++ b/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/State.vm @@ -0,0 +1,3 @@ +locale $node.Name +hai! +end \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/State/EqualsInit.vdmsl b/core/codegen/isagen/src/test/resources/modules/State/EqualsInit.vdmsl new file mode 100644 index 0000000000..3a148b2113 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/modules/State/EqualsInit.vdmsl @@ -0,0 +1,4 @@ +state S of + x : nat + init s == s = mk_S(0) +end \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/State/PredicateInit.vdmsl b/core/codegen/isagen/src/test/resources/modules/State/PredicateInit.vdmsl new file mode 100644 index 0000000000..dc68df1875 --- /dev/null +++ b/core/codegen/isagen/src/test/resources/modules/State/PredicateInit.vdmsl @@ -0,0 +1,4 @@ +state S of + x : nat + init s == s.x >0 +end \ No newline at end of file From 9a303eebb6cce62d3a3f992da0e572a1839ffe56 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 16:21:03 +0200 Subject: [PATCH 040/706] Improve integration test to report failure cause. --- .../test/java/org/overture/isapog/IsaPogIntegrationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/isapog/src/test/java/org/overture/isapog/IsaPogIntegrationTest.java b/core/isapog/src/test/java/org/overture/isapog/IsaPogIntegrationTest.java index 20f458b163..ea96335abb 100644 --- a/core/isapog/src/test/java/org/overture/isapog/IsaPogIntegrationTest.java +++ b/core/isapog/src/test/java/org/overture/isapog/IsaPogIntegrationTest.java @@ -51,8 +51,8 @@ public IsaPogResult processModel(List ast) } catch (AnalysisException | org.overture.codegen.cgast.analysis.AnalysisException e) { - e.printStackTrace(); - return new IsaPogResult("", "", true); + fail(e.getMessage()); + return null; } } From 688064750be57b5a3f08555dfa5f8bd12bda8444 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 17 Jul 2015 16:21:16 +0200 Subject: [PATCH 041/706] Add result file for alarm integration test. --- core/isapog/src/test/resources/integration/alarm.vdmsl.result | 1 + 1 file changed, 1 insertion(+) create mode 100644 core/isapog/src/test/resources/integration/alarm.vdmsl.result diff --git a/core/isapog/src/test/resources/integration/alarm.vdmsl.result b/core/isapog/src/test/resources/integration/alarm.vdmsl.result new file mode 100644 index 0000000000..a6bba2ac0e --- /dev/null +++ b/core/isapog/src/test/resources/integration/alarm.vdmsl.result @@ -0,0 +1 @@ +{"modelthy":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"Period \u003d \\\u003cparallel\u003e@token \\\u003cparallel\u003e\"\ndeclare Period_def [eval,evalp]\n\ndefinition \"ExpertId \u003d \\\u003cparallel\u003e@token \\\u003cparallel\u003e\"\ndeclare ExpertId_def [eval,evalp]\n\ndefinition \"Qualification \u003d \\\u003cparallel\u003e\u003cBio\u003e| \u003cChem\u003e| \u003cElec\u003e| \u003cMech\u003e \\\u003cparallel\u003e\"\ndeclare Qualification_def [eval,evalp]\n\n\ntypedef Expert_Tag \u003d \"{True}\" by auto\ninstantiation Expert_Tag :: tag\nbegin\ndefinition \"tagName_Expert_Tag (x::Expert_Tag) \u003d \u0027\u0027Expert\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_Expert_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_Expert \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@token*@set of @Qualification\n\\\u003cparallel\u003e TYPE(Expert_Tag)\"\nabbreviation\"expertid_fld \\\u003cequiv\u003e MkField maxty_Expert#[1]\\\u003cparallel\u003e@token\\\u003cparallel\u003e\"\nabbreviation\"expertid \\\u003cequiv\u003e SelectRec expertid_fld\"\nabbreviation\"eQuali_fld \\\u003cequiv\u003e MkField maxty_Expert#[2]\\\u003cparallel\u003e@set of @Qualification\n\\\u003cparallel\u003e\"\nabbreviation\"eQuali \\\u003cequiv\u003e SelectRec eQuali_fld\"\n\nvdmefun inv_Expert\n inp ex :: \"maxty_Expert\"\n out \"@bool\"\n is \"(^ex^.eQuali \u003c\u003e {})\" \n\ndefinition \"Expert \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_Expert inv ex \u003d\u003d inv_Expert(\u0026ex)\\\u003cparallel\u003e\"\ndeclare Expert_def [eval,evalp]\n\ndefinition \"mk_Expert \\\u003cequiv\u003eMkRec Expert\"\ndeclare mk_Expert_def [eval,evalp]\n\n\ntypedef Alarm_Tag \u003d \"{True}\" by auto\ninstantiation Alarm_Tag :: tag\nbegin\ndefinition \"tagName_Alarm_Tag (x::Alarm_Tag) \u003d \u0027\u0027Alarm\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_Alarm_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_Alarm \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@Qualification\n*@seq of @char\\\u003cparallel\u003e TYPE(Alarm_Tag)\"\nabbreviation\"aQuali_fld \\\u003cequiv\u003e MkField maxty_Alarm#[1]\\\u003cparallel\u003e@Qualification\n\\\u003cparallel\u003e\"\nabbreviation\"aQuali \\\u003cequiv\u003e SelectRec aQuali_fld\"\nabbreviation\"alarmtext_fld \\\u003cequiv\u003e MkField maxty_Alarm#[2]\\\u003cparallel\u003e@seq of @char\\\u003cparallel\u003e\"\nabbreviation\"alarmtext \\\u003cequiv\u003e SelectRec alarmtext_fld\"\n\n\n\ndefinition \"Alarm \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_Alarm \\\u003cparallel\u003e\"\ndeclare Alarm_def [eval,evalp]\n\ndefinition \"mk_Alarm \\\u003cequiv\u003eMkRec Alarm\"\ndeclare mk_Alarm_def [eval,evalp]\n\nvdmefun inv_Schedule\n inp sch :: \"@map @token to @set of maxty_Expert\"\n out \"@bool\"\n is \"(forall exs in @set rng (^sch^) \u0026 ((^exs^ \u003c\u003e {}) and (forall ex1, ex2 in @set ^exs^ \u0026 (not ((^ex1^ \u003c\u003e ^ex2^)) or (^ex1^.expertid \u003c\u003e ^ex2^.expertid)))))\" \n\ndefinition \"Schedule \u003d \\\u003cparallel\u003e@map @token to @set of maxty_Expert inv sch \u003d\u003d inv_Schedule(\u0026sch)\\\u003cparallel\u003e\"\ndeclare Schedule_def [eval,evalp]\n\n\ntypedef Plant_Tag \u003d \"{True}\" by auto\ninstantiation Plant_Tag :: tag\nbegin\ndefinition \"tagName_Plant_Tag (x::Plant_Tag) \u003d \u0027\u0027Plant\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_Plant_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_Plant \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@map @token to @set of maxty_Expert*@set of maxty_Alarm\\\u003cparallel\u003e TYPE(Plant_Tag)\"\nabbreviation\"schedule_fld \\\u003cequiv\u003e MkField maxty_Plant#[1]\\\u003cparallel\u003e@map @token to @set of maxty_Expert\\\u003cparallel\u003e\"\nabbreviation\"schedule \\\u003cequiv\u003e SelectRec schedule_fld\"\nabbreviation\"alarms_fld \\\u003cequiv\u003e MkField maxty_Plant#[2]\\\u003cparallel\u003e@set of maxty_Alarm\\\u003cparallel\u003e\"\nabbreviation\"alarms \\\u003cequiv\u003e SelectRec alarms_fld\"\n\nvdmefun inv_Plant\n inp p :: \"maxty_Plant\"\n out \"@bool\"\n is \"(forall a in @set ^p^.alarms \u0026 (forall peri in @set dom (^p^.schedule) \u0026 true))\" \n\ndefinition \"Plant \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_Plant inv p \u003d\u003d inv_Plant(\u0026p)\\\u003cparallel\u003e\"\ndeclare Plant_def [eval,evalp]\n\ndefinition \"mk_Plant \\\u003cequiv\u003eMkRec Plant\"\ndeclare mk_Plant_def [eval,evalp]\n\nvdmefun NumberOfExperts\n inp peri :: \"@token\" and plant :: \"maxty_Plant\"\n out \"@nat\"\n pre \"(^peri^ in @set dom (^plant^.schedule))\"\n is \"card (^plant^.schedule[^peri^])\" \n\nvdmefun ExpertIsOnDuty\n inp ex :: \"maxty_Expert\" and p :: \"maxty_Plant\"\n out \"@set of @token\"\n is \"{^peri^ | peri in @set dom (^p^.schedule) \u0026 (^ex^ in @set ^p^.schedule[^peri^])}\" \n\nvdmifun ExpertToPage\n inp a :: \"maxty_Alarm\" and peri :: \"@token\" and plant :: \"maxty_Plant\"\n out r :: \"maxty_Expert\"\n pre \"((^peri^ in @set dom (^plant^.schedule)) and (^a^ in @set ^plant^.alarms))\"\n post \"((^r^ in @set ^plant^.schedule[^peri^]) and (^a^.aQuali in @set ^r^.eQuali))\"\n\n\nvdmefun QualificationOK\n inp exs :: \"@set of maxty_Expert\" and reqquali :: \"@Qualification\n\"\n out \"@bool\"\n is \"(exists ex in @set ^exs^ \u0026 (^reqquali^ in @set ^ex^.eQuali))\" \n\nend","posthy":"theory DEFAULT_POs\nimports DEFAULT\nbegin\n\n(* Expert: type invariant satisfiable obligation @ in \u0027DEFAULT\u0027 (alarm.vdmsl) at line 8:3\n(exists ex:Expert \u0026 ((ex.eQuali) \u003c\u003e {})) *)\nlemma POExpert1: \"+|(exists ex : maxty_Expert \u0026 (^ex^.eQuali \u003c\u003e {}))|+\" by vdm_auto_tac\n\n(* Schedule: type invariant satisfiable obligation @ in \u0027DEFAULT\u0027 (alarm.vdmsl) at line 15:3\n(exists sch:Schedule \u0026 (forall exs in set (rng sch) \u0026 ((exs \u003c\u003e {}) and (forall ex1, ex2 in set exs \u0026 ((ex1 \u003c\u003e ex2) \u003d\u003e ((ex1.expertid) \u003c\u003e (ex2.expertid))))))) *)\nlemma POSchedule2: \"+|(exists sch : @map @token to @set of maxty_Expert \u0026 (forall exs in @set rng (^sch^) \u0026 ((^exs^ \u003c\u003e {}) and (forall ex1, ex2 in @set ^exs^ \u0026 (not ((^ex1^ \u003c\u003e ^ex2^)) or (^ex1^.expertid \u003c\u003e ^ex2^.expertid))))))|+\" by vdm_auto_tac\n\n(* Plant: type invariant satisfiable obligation @ in \u0027DEFAULT\u0027 (alarm.vdmsl) at line 23:3\n(exists p:Plant \u0026 (forall a in set (p.alarms) \u0026 (forall peri in set (dom (p.schedule)) \u0026 true))) *)\nlemma POPlant3: \"+|(exists p : maxty_Plant \u0026 (forall a in @set ^p^.alarms \u0026 (forall peri in @set dom (^p^.schedule) \u0026 true)))|+\" by vdm_auto_tac\n\n(* NumberOfExperts: legal map application obligation @ in \u0027DEFAULT\u0027 (alarm.vdmsl) at line 33:10\n(forall peri:Period, plant:Plant \u0026 ((peri in set (dom (plant.schedule))) \u003d\u003e (peri in set (dom (plant.schedule))))) *)\nlemma PONumberOfExperts4: \"+|(forall peri : @token, plant : maxty_Plant \u0026 (not ((^peri^ in @set dom (^plant^.schedule))) or (^peri^ in @set dom (^plant^.schedule))))|+\" by vdm_auto_tac\n\n(* ExpertIsOnDuty: legal map application obligation @ in \u0027DEFAULT\u0027 (alarm.vdmsl) at line 38:51\n(forall ex:Expert, p:Plant \u0026 (forall peri in set (dom (p.schedule)) \u0026 (peri in set (dom (p.schedule))))) *)\nlemma POExpertIsOnDuty5: \"+|(forall ex : maxty_Expert, p : maxty_Plant \u0026 (forall peri in @set dom (^p^.schedule) \u0026 (^peri^ in @set dom (^p^.schedule))))|+\" by vdm_auto_tac\n\n(* ExpertToPage: legal map application obligation @ in \u0027DEFAULT\u0027 (alarm.vdmsl) at line 43:17\n(forall a:Alarm, peri:Period, plant:Plant \u0026 (((peri in set (dom (plant.schedule))) and (a in set (plant.alarms))) \u003d\u003e (exists r:Expert \u0026 (peri in set (dom (plant.schedule)))))) *)\nlemma POExpertToPage6: \"+|(forall a : maxty_Alarm, peri : @token, plant : maxty_Plant \u0026 (not (((^peri^ in @set dom (^plant^.schedule)) and (^a^ in @set ^plant^.alarms))) or (exists r : maxty_Expert \u0026 (^peri^ in @set dom (^plant^.schedule)))))|+\" by vdm_auto_tac\n\n(* ExpertToPage: function postcondition satisfiable obligation @ in \u0027DEFAULT\u0027 (alarm.vdmsl) at line 40:3\n(forall a:Alarm, peri:Period, plant:Plant \u0026 (pre_ExpertToPage(a, peri, plant) \u003d\u003e (exists r:Expert \u0026 post_ExpertToPage(a, peri, plant, r)))) *)\nlemma POExpertToPage7: \"+|(forall a : maxty_Alarm, peri : @token, plant : maxty_Plant \u0026 (not (pre_ExpertToPage(^a^, ^peri^, ^plant^)) or (exists r : maxty_Expert \u0026 post_ExpertToPage(^a^, ^peri^, ^plant^, ^r^))))|+\" by vdm_auto_tac\n\nend","negative":false} \ No newline at end of file From 619d5451dd28185ba7dea58db8f4fb2fcfe65437 Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Thu, 20 Aug 2015 09:48:34 +0100 Subject: [PATCH 042/706] Import new IsaVdm theory (vdm_sl) Issue: --- .../src/main/resources/IsaTemplates/Declarations/Module.vm | 2 +- .../modules/Functions/Explicit/FuncApply1Param.vdmsl.result | 2 +- .../modules/Functions/Explicit/FuncApply3Params.vdmsl.result | 2 +- .../modules/Functions/Explicit/FuncApplyNoParam.vdmsl.result | 2 +- .../modules/Functions/Explicit/FuncDecl1Param.vdmsl.result | 2 +- .../modules/Functions/Explicit/FuncDecl2Params.vdmsl.result | 2 +- .../modules/Functions/Explicit/FuncDeclNoParam.vdmsl.result | 2 +- .../modules/Functions/Explicit/FuncDepSimple.vdmsl.result | 2 +- .../resources/modules/Functions/Explicit/FuncPost.vdmsl.result | 2 +- .../resources/modules/Functions/Explicit/FuncPre.vdmsl.result | 2 +- .../modules/Functions/Explicit/FuncPrePost.vdmsl.result | 2 +- .../modules/Functions/Explicit/NotYetSpecified.vdmsl.result | 2 +- .../modules/Functions/Implicit/1ParamNoPre.vdmsl.result | 2 +- .../modules/Functions/Implicit/1ParamPrePost.vdmsl.result | 2 +- .../modules/Functions/Implicit/2ParamsPrePost.vdmsl.result | 2 +- .../modules/Functions/Implicit/NoParamNoPre.vdmsl.result | 2 +- .../modules/Functions/Implicit/NoParamPrePost.vdmsl.result | 2 +- .../src/test/resources/modules/Types/InvTypes/Int.vdmsl.result | 2 +- .../modules/Types/InvTypes/RecordDummyInv.vdmsl.result | 2 +- .../src/test/resources/modules/Types/InvTypes/Set.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/Char.vdmsl.result | 2 +- .../modules/Types/NoInv/CharNatTokenTuple.vdmsl.result | 2 +- .../modules/Types/NoInv/CharSeqIntSetTuple.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/Int.vdmsl.result | 2 +- .../resources/modules/Types/NoInv/IntCharTuple.vdmsl.result | 2 +- .../test/resources/modules/Types/NoInv/IntIntTuple.vdmsl.result | 2 +- .../test/resources/modules/Types/NoInv/MapIntChar.vdmsl.result | 2 +- .../test/resources/modules/Types/NoInv/MapIntInt.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/Nat.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/Nat1.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/Rat.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/Real.vdmsl.result | 2 +- .../test/resources/modules/Types/NoInv/Rec1Field.vdmsl.result | 2 +- .../test/resources/modules/Types/NoInv/Rec2Fields.vdmsl.result | 2 +- .../modules/Types/NoInv/Rec2FieldsDiffTypes.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/SeqInt.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/SetInt.vdmsl.result | 2 +- .../src/test/resources/modules/Types/NoInv/Token.vdmsl.result | 2 +- .../src/test/resources/modules/Values/BoolType.vdmsl.result | 2 +- .../src/test/resources/modules/Values/ExplicitInt.vdmsl.result | 2 +- .../src/test/resources/modules/Values/ExplicitNat.vdmsl.result | 2 +- .../src/test/resources/modules/Values/ExplicitNat1.vdmsl.result | 2 +- .../src/test/resources/modules/Values/ExplicitReal.vdmsl.result | 2 +- .../resources/modules/Values/ImplicitNumericExp.vdmsl.result | 2 +- .../resources/modules/Values/IndependentDefsOrder.vdmsl.result | 2 +- .../src/test/resources/modules/Values/IntExpVarExp.vdmsl.result | 2 +- .../src/test/resources/modules/Values/VarExp.vdmsl.result | 2 +- 47 files changed, 47 insertions(+), 47 deletions(-) diff --git a/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/Module.vm b/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/Module.vm index d757e9a503..07b88a6a80 100644 --- a/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/Module.vm +++ b/core/codegen/isagen/src/main/resources/IsaTemplates/Declarations/Module.vm @@ -1,5 +1,5 @@ theory $Isa.norm($node.Name) - imports utp_vdm + imports vdm_sl begin #foreach( $decl in $node.Decls ) diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApply1Param.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApply1Param.vdmsl.result index 4fd3eb59dc..d4ac6743ac 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApply1Param.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApply1Param.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n is \"0\"\n\ndefinition \"x \u003d +|f(1) : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n is \"0\" \n\ndefinition \"x \u003d +|f(1) : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApply3Params.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApply3Params.vdmsl.result index f3529f911b..0fb798e57c 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApply3Params.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApply3Params.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\" and y :: \"@int\" and z :: \"@int\"\n out \"@int\"\n is \"0\"\n\ndefinition \"x \u003d +|f(1, 2, 3) : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp x :: \"@int\" and y :: \"@int\" and z :: \"@int\"\n out \"@int\"\n is \"0\" \n\ndefinition \"x \u003d +|f(1, 2, 3) : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApplyNoParam.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApplyNoParam.vdmsl.result index e506e8bb7e..a3f80024e6 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApplyNoParam.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncApplyNoParam.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp \n out \"@int\"\n is \"0\"\n\ndefinition \"x \u003d +|f() : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp \n out \"@int\"\n is \"0\" \n\ndefinition \"x \u003d +|f() : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDecl1Param.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDecl1Param.vdmsl.result index 76bbe393d2..772e2cbe6e 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDecl1Param.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDecl1Param.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@nat\"\n out \"@nat\"\n is \"^x^\"\n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp x :: \"@nat\"\n out \"@nat\"\n is \"^x^\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDecl2Params.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDecl2Params.vdmsl.result index bacb3a35c6..441dde9330 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDecl2Params.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDecl2Params.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@nat\" and y :: \"@nat\"\n out \"@nat\"\n is \"^x^\"\n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp x :: \"@nat\" and y :: \"@nat\"\n out \"@nat\"\n is \"^x^\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDeclNoParam.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDeclNoParam.vdmsl.result index 1efb7c091f..69aa6f538a 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDeclNoParam.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDeclNoParam.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp \n out \"@nat\"\n is \"0\"\n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp \n out \"@nat\"\n is \"0\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDepSimple.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDepSimple.vdmsl.result index 8d5ae46759..8318ec44e2 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDepSimple.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncDepSimple.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun g\n inp x :: \"@int\"\n out \"@int\"\n is \"0\"\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n is \"g(^x^)\"\n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun g\n inp x :: \"@int\"\n out \"@int\"\n is \"0\" \n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n is \"g(^x^)\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPost.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPost.vdmsl.result index 89b46d1c32..36b56a47f3 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPost.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPost.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n post \"true\"\n is \"0\" \n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n post \"true\"\n is \"0\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPre.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPre.vdmsl.result index 364a6a2dbe..1379440b25 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPre.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPre.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n pre \"true\"\n is \"0\" \n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n pre \"true\"\n is \"0\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPrePost.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPrePost.vdmsl.result index fd73361b7d..cf2661cde8 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPrePost.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/FuncPrePost.vdmsl.result @@ -1 +1 @@ -{"translation":"theory A\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n pre \"true\"\n post \"true\"\n is \"0\" \n\nend","errors":false} \ No newline at end of file +{"translation":"theory A\n imports vdm_sl\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@int\"\n pre \"true\"\n post \"true\"\n is \"0\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/NotYetSpecified.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/NotYetSpecified.vdmsl.result index 0b1bde1a4b..9337b6d2bb 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/NotYetSpecified.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Explicit/NotYetSpecified.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@token\"\n is \"undef\" \n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\nvdmefun f\n inp x :: \"@int\"\n out \"@token\"\n is \"undef\" \n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/1ParamNoPre.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/1ParamNoPre.vdmsl.result index 91fc6a64d2..f12ef838c0 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/1ParamNoPre.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/1ParamNoPre.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmifun f\n inp x :: \"@int\"\n out r :: \"@int\"\n post \"(^r^ \u003d ^x^)\"\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\nvdmifun f\n inp x :: \"@int\"\n out r :: \"@int\"\n post \"(^r^ \u003d ^x^)\"\n\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/1ParamPrePost.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/1ParamPrePost.vdmsl.result index 79a6931aac..3fd942c2f4 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/1ParamPrePost.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/1ParamPrePost.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmifun f\n inp x :: \"@int\"\n out r :: \"@int\"\n pre \"true\"\n post \"(^r^ \u003d ^x^)\"\n\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\nvdmifun f\n inp x :: \"@int\"\n out r :: \"@int\"\n pre \"true\"\n post \"(^r^ \u003d ^x^)\"\n\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/2ParamsPrePost.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/2ParamsPrePost.vdmsl.result index c72127e108..58e6236238 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/2ParamsPrePost.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/2ParamsPrePost.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmifun f\n inp x :: \"@int\" and y :: \"@int\"\n out r :: \"@int\"\n pre \"(^y^ \u003c\u003e 0)\"\n post \"((^x^ / ^y^) \u003d ^r^)\"\n\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\nvdmifun f\n inp x :: \"@int\" and y :: \"@int\"\n out r :: \"@int\"\n pre \"(^y^ \u003c\u003e 0)\"\n post \"((^x^ / ^y^) \u003d ^r^)\"\n\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/NoParamNoPre.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/NoParamNoPre.vdmsl.result index f31e0df750..40035c1ac5 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/NoParamNoPre.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/NoParamNoPre.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmifun f\n inp emptyParam :: \"@bool\"\n out r :: \"@int\"\n post \"true\"\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\nvdmifun f\n inp emptyParam :: \"@bool\"\n out r :: \"@int\"\n post \"true\"\n\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/NoParamPrePost.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/NoParamPrePost.vdmsl.result index b9d3bbf263..f10ba1fe00 100644 --- a/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/NoParamPrePost.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Functions/Implicit/NoParamPrePost.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmifun f\n inp emptyParam :: \"@bool\"\n out r :: \"@int\"\n pre \"true\"\n post \"true\"\n\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\nvdmifun f\n inp emptyParam :: \"@bool\"\n out r :: \"@int\"\n pre \"true\"\n post \"true\"\n\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/Int.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/Int.vdmsl.result index 04c2ff5612..4287e70717 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/Int.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/Int.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmefun inv_t\n inp t :: \"@int\"\n out \"@bool\"\n is \"(^t^ \u003e 0)\" \n\ndefinition \"t \u003d \\\u003cparallel\u003e@int inv t \u003d\u003d inv_t(\u0026t)\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\nvdmefun inv_t\n inp t :: \"@int\"\n out \"@bool\"\n is \"(^t^ \u003e 0)\" \n\ndefinition \"t \u003d \\\u003cparallel\u003e@int inv t \u003d\u003d inv_t(\u0026t)\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/RecordDummyInv.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/RecordDummyInv.vdmsl.result index 474c1f87ab..502f498f86 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/RecordDummyInv.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/RecordDummyInv.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\n\ntypedef A_Tag \u003d \"{True}\" by auto\ninstantiation A_Tag :: tag\nbegin\ndefinition \"tagName_A_Tag (x::A_Tag) \u003d \u0027\u0027A\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_A_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_A \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@char*@int\\\u003cparallel\u003e TYPE(A_Tag)\"\nabbreviation\"b_fld \\\u003cequiv\u003e MkField maxty_A#[1]\\\u003cparallel\u003e@char\\\u003cparallel\u003e\"\nabbreviation\"b \\\u003cequiv\u003e SelectRec b_fld\"\nabbreviation\"c_fld \\\u003cequiv\u003e MkField maxty_A#[2]\\\u003cparallel\u003e@int\\\u003cparallel\u003e\"\nabbreviation\"c \\\u003cequiv\u003e SelectRec c_fld\"\n\nvdmefun inv_A\n inp a :: \"maxty_A\"\n out \"@bool\"\n is \"true\" \n\ndefinition \"A \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_A inv a \u003d\u003d inv_A(\u0026a)\\\u003cparallel\u003e\"\ndeclare A_def [eval,evalp]\n\ndefinition \"mk_A \\\u003cequiv\u003eMkRec A\"\ndeclare mk_A_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\n\ntypedef A_Tag \u003d \"{True}\" by auto\ninstantiation A_Tag :: tag\nbegin\ndefinition \"tagName_A_Tag (x::A_Tag) \u003d \u0027\u0027A\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_A_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_A \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@char*@int\\\u003cparallel\u003e TYPE(A_Tag)\"\nabbreviation\"b_fld \\\u003cequiv\u003e MkField maxty_A#[1]\\\u003cparallel\u003e@char\\\u003cparallel\u003e\"\nabbreviation\"b \\\u003cequiv\u003e SelectRec b_fld\"\nabbreviation\"c_fld \\\u003cequiv\u003e MkField maxty_A#[2]\\\u003cparallel\u003e@int\\\u003cparallel\u003e\"\nabbreviation\"c \\\u003cequiv\u003e SelectRec c_fld\"\n\nvdmefun inv_A\n inp a :: \"maxty_A\"\n out \"@bool\"\n is \"true\" \n\ndefinition \"A \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_A inv a \u003d\u003d inv_A(\u0026a)\\\u003cparallel\u003e\"\ndeclare A_def [eval,evalp]\n\ndefinition \"mk_A \\\u003cequiv\u003eMkRec A\"\ndeclare mk_A_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/Set.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/Set.vdmsl.result index e36a0de795..500fcc8401 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/Set.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/InvTypes/Set.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\nvdmefun inv_t\n inp t :: \"@set of @int\"\n out \"@bool\"\n is \"(^t^ \u003c\u003e {})\" \n\ndefinition \"t \u003d \\\u003cparallel\u003e@set of @int inv t \u003d\u003d inv_t(\u0026t)\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\nvdmefun inv_t\n inp t :: \"@set of @int\"\n out \"@bool\"\n is \"(^t^ \u003c\u003e {})\" \n\ndefinition \"t \u003d \\\u003cparallel\u003e@set of @int inv t \u003d\u003d inv_t(\u0026t)\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Char.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Char.vdmsl.result index 417ad31699..dabcd7c0a0 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Char.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Char.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@char\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@char \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/CharNatTokenTuple.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/CharNatTokenTuple.vdmsl.result index 0282c4aa15..ac99b1627d 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/CharNatTokenTuple.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/CharNatTokenTuple.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@char * @nat * @token\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@char * @nat * @token \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/CharSeqIntSetTuple.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/CharSeqIntSetTuple.vdmsl.result index 1328fc5ab2..96f8f02cb5 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/CharSeqIntSetTuple.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/CharSeqIntSetTuple.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@seq of @char * @set of @int\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@seq of @char * @set of @int \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Int.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Int.vdmsl.result index fa11d6cf66..111e62b653 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Int.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Int.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@int\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@int \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/IntCharTuple.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/IntCharTuple.vdmsl.result index ec11a21f79..8bef740efe 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/IntCharTuple.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/IntCharTuple.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@int * @char\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@int * @char \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/IntIntTuple.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/IntIntTuple.vdmsl.result index 255ddd2164..7aa1ebd6ad 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/IntIntTuple.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/IntIntTuple.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@int * @int\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@int * @int \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/MapIntChar.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/MapIntChar.vdmsl.result index be6e8c9c6c..903931462a 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/MapIntChar.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/MapIntChar.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@map @int to @char\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@map @int to @char \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/MapIntInt.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/MapIntInt.vdmsl.result index c1800a8bf8..22f1cd17f6 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/MapIntInt.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/MapIntInt.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@map @int to @int\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@map @int to @int \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Nat.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Nat.vdmsl.result index c2a2eb6756..caabd0d78f 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Nat.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Nat.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@nat\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@nat \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Nat1.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Nat1.vdmsl.result index ddab8429b8..e7620d86a6 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Nat1.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Nat1.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@nat1\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@nat1 \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rat.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rat.vdmsl.result index 29beb9fcff..aedae89e79 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rat.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rat.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@rat\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@rat \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Real.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Real.vdmsl.result index 96894201d4..51457afe7d 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Real.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Real.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@real\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@real \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec1Field.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec1Field.vdmsl.result index d7df202d39..b5dc4697bc 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec1Field.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec1Field.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\n\ntypedef RecType_Tag \u003d \"{True}\" by auto\ninstantiation RecType_Tag :: tag\nbegin\ndefinition \"tagName_RecType_Tag (x::RecType_Tag) \u003d \u0027\u0027RecType\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_RecType_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_RecType \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@nat\\\u003cparallel\u003e TYPE(RecType_Tag)\"\nabbreviation\"x_fld \\\u003cequiv\u003e MkField maxty_RecType#[1]\\\u003cparallel\u003e@nat\\\u003cparallel\u003e\"\nabbreviation\"x \\\u003cequiv\u003e SelectRec x_fld\"\n\ndefinition \"RecType \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_RecType\\\u003cparallel\u003e\"\ndeclare RecType_def [eval,evalp]\n\ndefinition \"mk_RecType \\\u003cequiv\u003eMkRec RecType\"\ndeclare mk_RecType_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\n\ntypedef RecType_Tag \u003d \"{True}\" by auto\ninstantiation RecType_Tag :: tag\nbegin\ndefinition \"tagName_RecType_Tag (x::RecType_Tag) \u003d \u0027\u0027RecType\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_RecType_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_RecType \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@nat\\\u003cparallel\u003e TYPE(RecType_Tag)\"\nabbreviation\"x_fld \\\u003cequiv\u003e MkField maxty_RecType#[1]\\\u003cparallel\u003e@nat\\\u003cparallel\u003e\"\nabbreviation\"x \\\u003cequiv\u003e SelectRec x_fld\"\n\n\n\ndefinition \"RecType \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_RecType \\\u003cparallel\u003e\"\ndeclare RecType_def [eval,evalp]\n\ndefinition \"mk_RecType \\\u003cequiv\u003eMkRec RecType\"\ndeclare mk_RecType_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec2Fields.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec2Fields.vdmsl.result index 58aaa8bb57..213b8861b8 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec2Fields.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec2Fields.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\n\ntypedef RecType_Tag \u003d \"{True}\" by auto\ninstantiation RecType_Tag :: tag\nbegin\ndefinition \"tagName_RecType_Tag (x::RecType_Tag) \u003d \u0027\u0027RecType\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_RecType_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_RecType \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@nat*@nat\\\u003cparallel\u003e TYPE(RecType_Tag)\"\nabbreviation\"x_fld \\\u003cequiv\u003e MkField maxty_RecType#[1]\\\u003cparallel\u003e@nat\\\u003cparallel\u003e\"\nabbreviation\"x \\\u003cequiv\u003e SelectRec x_fld\"\nabbreviation\"y_fld \\\u003cequiv\u003e MkField maxty_RecType#[2]\\\u003cparallel\u003e@nat\\\u003cparallel\u003e\"\nabbreviation\"y \\\u003cequiv\u003e SelectRec y_fld\"\n\ndefinition \"RecType \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_RecType\\\u003cparallel\u003e\"\ndeclare RecType_def [eval,evalp]\n\ndefinition \"mk_RecType \\\u003cequiv\u003eMkRec RecType\"\ndeclare mk_RecType_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\n\ntypedef RecType_Tag \u003d \"{True}\" by auto\ninstantiation RecType_Tag :: tag\nbegin\ndefinition \"tagName_RecType_Tag (x::RecType_Tag) \u003d \u0027\u0027RecType\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_RecType_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_RecType \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@nat*@nat\\\u003cparallel\u003e TYPE(RecType_Tag)\"\nabbreviation\"x_fld \\\u003cequiv\u003e MkField maxty_RecType#[1]\\\u003cparallel\u003e@nat\\\u003cparallel\u003e\"\nabbreviation\"x \\\u003cequiv\u003e SelectRec x_fld\"\nabbreviation\"y_fld \\\u003cequiv\u003e MkField maxty_RecType#[2]\\\u003cparallel\u003e@nat\\\u003cparallel\u003e\"\nabbreviation\"y \\\u003cequiv\u003e SelectRec y_fld\"\n\n\n\ndefinition \"RecType \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_RecType \\\u003cparallel\u003e\"\ndeclare RecType_def [eval,evalp]\n\ndefinition \"mk_RecType \\\u003cequiv\u003eMkRec RecType\"\ndeclare mk_RecType_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec2FieldsDiffTypes.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec2FieldsDiffTypes.vdmsl.result index 67ec792f54..f5da5e2650 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec2FieldsDiffTypes.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Rec2FieldsDiffTypes.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\n\ntypedef RecType_Tag \u003d \"{True}\" by auto\ninstantiation RecType_Tag :: tag\nbegin\ndefinition \"tagName_RecType_Tag (x::RecType_Tag) \u003d \u0027\u0027RecType\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_RecType_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_RecType \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@char*@real\\\u003cparallel\u003e TYPE(RecType_Tag)\"\nabbreviation\"x_fld \\\u003cequiv\u003e MkField maxty_RecType#[1]\\\u003cparallel\u003e@char\\\u003cparallel\u003e\"\nabbreviation\"x \\\u003cequiv\u003e SelectRec x_fld\"\nabbreviation\"y_fld \\\u003cequiv\u003e MkField maxty_RecType#[2]\\\u003cparallel\u003e@real\\\u003cparallel\u003e\"\nabbreviation\"y \\\u003cequiv\u003e SelectRec y_fld\"\n\ndefinition \"RecType \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_RecType\\\u003cparallel\u003e\"\ndeclare RecType_def [eval,evalp]\n\ndefinition \"mk_RecType \\\u003cequiv\u003eMkRec RecType\"\ndeclare mk_RecType_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\n\ntypedef RecType_Tag \u003d \"{True}\" by auto\ninstantiation RecType_Tag :: tag\nbegin\ndefinition \"tagName_RecType_Tag (x::RecType_Tag) \u003d \u0027\u0027RecType\u0027\u0027\"\ninstance\nby (intro_classes, metis (full_types) Abs_RecType_Tag_cases singleton_iff)\nend\n\nabbreviation\"maxty_RecType \\\u003cequiv\u003e RecMaximalType \\\u003cparallel\u003e@char*@real\\\u003cparallel\u003e TYPE(RecType_Tag)\"\nabbreviation\"x_fld \\\u003cequiv\u003e MkField maxty_RecType#[1]\\\u003cparallel\u003e@char\\\u003cparallel\u003e\"\nabbreviation\"x \\\u003cequiv\u003e SelectRec x_fld\"\nabbreviation\"y_fld \\\u003cequiv\u003e MkField maxty_RecType#[2]\\\u003cparallel\u003e@real\\\u003cparallel\u003e\"\nabbreviation\"y \\\u003cequiv\u003e SelectRec y_fld\"\n\n\n\ndefinition \"RecType \\\u003cequiv\u003e\\\u003cparallel\u003e@maxty_RecType \\\u003cparallel\u003e\"\ndeclare RecType_def [eval,evalp]\n\ndefinition \"mk_RecType \\\u003cequiv\u003eMkRec RecType\"\ndeclare mk_RecType_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/SeqInt.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/SeqInt.vdmsl.result index fb9ae6bb8d..9a00349fe3 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/SeqInt.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/SeqInt.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@seq of @int\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@seq of @int \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/SetInt.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/SetInt.vdmsl.result index 6f4b97edc9..a29db9fe29 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/SetInt.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/SetInt.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@set of @int\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@set of @int \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Token.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Token.vdmsl.result index 25c2f6bc78..bf44f6a2bc 100644 --- a/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Token.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Types/NoInv/Token.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@token\\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"t \u003d \\\u003cparallel\u003e@token \\\u003cparallel\u003e\"\ndeclare t_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/BoolType.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/BoolType.vdmsl.result index 0d35fc8678..42e76383d6 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/BoolType.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/BoolType.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|true : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"x \u003d +|true : @bool|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/ExplicitInt.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/ExplicitInt.vdmsl.result index 1d4760f5a0..4686afd447 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/ExplicitInt.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/ExplicitInt.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|1 : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"x \u003d +|1 : @int|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/ExplicitNat.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/ExplicitNat.vdmsl.result index 22d8f7f43c..2d137d33ad 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/ExplicitNat.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/ExplicitNat.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|1 : @nat|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"x \u003d +|1 : @nat|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/ExplicitNat1.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/ExplicitNat1.vdmsl.result index 501125384b..ffa0cacbe1 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/ExplicitNat1.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/ExplicitNat1.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|1 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"x \u003d +|1 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/ExplicitReal.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/ExplicitReal.vdmsl.result index 7b282e7c4c..caadbfc971 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/ExplicitReal.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/ExplicitReal.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|1.2 : @real|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"x \u003d +|1.2 : @real|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/ImplicitNumericExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/ImplicitNumericExp.vdmsl.result index 501125384b..ffa0cacbe1 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/ImplicitNumericExp.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/ImplicitNumericExp.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|1 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"x \u003d +|1 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/IndependentDefsOrder.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/IndependentDefsOrder.vdmsl.result index a6c26c2996..1fca54ee55 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/IndependentDefsOrder.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/IndependentDefsOrder.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"a \u003d +|10 : @nat1|+\"\ndeclare a_def [eval,evalp]\n\ndefinition \"b \u003d +|20 : @nat1|+\"\ndeclare b_def [eval,evalp]\n\ndefinition \"c \u003d +|30 : @nat1|+\"\ndeclare c_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"a \u003d +|10 : @nat1|+\"\ndeclare a_def [eval,evalp]\n\ndefinition \"b \u003d +|20 : @nat1|+\"\ndeclare b_def [eval,evalp]\n\ndefinition \"c \u003d +|30 : @nat1|+\"\ndeclare c_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/IntExpVarExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/IntExpVarExp.vdmsl.result index 972759bef4..6718a8866b 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/IntExpVarExp.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/IntExpVarExp.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|1 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\ndefinition \"y \u003d +|^x^ : @nat1|+\"\ndeclare y_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"x \u003d +|1 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\ndefinition \"y \u003d +|^x^ : @nat1|+\"\ndeclare y_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file diff --git a/core/codegen/isagen/src/test/resources/modules/Values/VarExp.vdmsl.result b/core/codegen/isagen/src/test/resources/modules/Values/VarExp.vdmsl.result index 972759bef4..6718a8866b 100644 --- a/core/codegen/isagen/src/test/resources/modules/Values/VarExp.vdmsl.result +++ b/core/codegen/isagen/src/test/resources/modules/Values/VarExp.vdmsl.result @@ -1 +1 @@ -{"translation":"theory DEFAULT\n imports utp_vdm\nbegin\n\ndefinition \"x \u003d +|1 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\ndefinition \"y \u003d +|^x^ : @nat1|+\"\ndeclare y_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file +{"translation":"theory DEFAULT\n imports vdm_sl\nbegin\n\ndefinition \"x \u003d +|1 : @nat1|+\"\ndeclare x_def [eval,evalp]\n\ndefinition \"y \u003d +|^x^ : @nat1|+\"\ndeclare y_def [eval,evalp]\n\nend","errors":false} \ No newline at end of file From 763eb4cfd878a9d0d60ecf1deee7f173f5d75371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 21 Sep 2015 12:54:07 +0200 Subject: [PATCH 043/706] Fix to construction of pre condition definitions for operations --- .../definition/AExplicitOperationDefinitionAssistantTC.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/typechecker/src/main/java/org/overture/typechecker/assistant/definition/AExplicitOperationDefinitionAssistantTC.java b/core/typechecker/src/main/java/org/overture/typechecker/assistant/definition/AExplicitOperationDefinitionAssistantTC.java index 53b0fc5d62..876ebbf1c7 100644 --- a/core/typechecker/src/main/java/org/overture/typechecker/assistant/definition/AExplicitOperationDefinitionAssistantTC.java +++ b/core/typechecker/src/main/java/org/overture/typechecker/assistant/definition/AExplicitOperationDefinitionAssistantTC.java @@ -143,7 +143,7 @@ public AExplicitFunctionDefinition getPreDefinition( // though at runtime these are passed via a "self" parameter. def.setAccess(af.createPAccessSpecifierAssistant().getStatic(def, false)); - def.setClassDefinition(def.getClassDefinition()); + def.setClassDefinition(d.getClassDefinition()); return def; } From 0defad33840b36892b1d7ce22b9e3f8eb2fa2bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 21 Sep 2015 16:27:37 +0200 Subject: [PATCH 044/706] IR construction of 'cycles' and 'duration' statement --- core/codegen/ir/src/main/resources/cg.astv2 | 2 ++ .../codegen/visitor/StmVisitorCG.java | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/core/codegen/ir/src/main/resources/cg.astv2 b/core/codegen/ir/src/main/resources/cg.astv2 index 0da6772d47..86b868b871 100644 --- a/core/codegen/ir/src/main/resources/cg.astv2 +++ b/core/codegen/ir/src/main/resources/cg.astv2 @@ -298,6 +298,8 @@ CG {-> package='org.overture.codegen.cgast' | {mapSeqUpdate} [col]:CG.#exp [index]:CG.#exp [value]:CG.#exp | {invCheck} [subject]:CG.#exp | {atomic} [statements]:CG.#stm* + | {cycles} [cycles]:CG.#exp [stm]:CG.#stm + | {duration} [duration]:CG.#exp [stm]:CG.#stm | {meta} ; diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/StmVisitorCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/StmVisitorCG.java index 8053a61eb5..395f4cca6c 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/StmVisitorCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/StmVisitorCG.java @@ -45,6 +45,8 @@ import org.overture.ast.statements.ACaseAlternativeStm; import org.overture.ast.statements.ACasesStm; import org.overture.ast.statements.AClassInvariantStm; +import org.overture.ast.statements.ACyclesStm; +import org.overture.ast.statements.ADurationStm; import org.overture.ast.statements.AElseIfStm; import org.overture.ast.statements.AErrorStm; import org.overture.ast.statements.AForAllStm; @@ -83,6 +85,8 @@ import org.overture.codegen.cgast.statements.ACallObjectStmCG; import org.overture.codegen.cgast.statements.ACaseAltStmStmCG; import org.overture.codegen.cgast.statements.ACasesStmCG; +import org.overture.codegen.cgast.statements.ACyclesStmCG; +import org.overture.codegen.cgast.statements.ADurationStmCG; import org.overture.codegen.cgast.statements.AElseIfStmCG; import org.overture.codegen.cgast.statements.AErrorStmCG; import org.overture.codegen.cgast.statements.AForAllStmCG; @@ -227,6 +231,38 @@ public SStmCG caseAAtomicStm(AAtomicStm node, IRInfo question) return atomicBlock; } + + @Override + public SStmCG caseACyclesStm(ACyclesStm node, IRInfo question) throws AnalysisException + { + PExp cycles = node.getCycles(); + PStm stm = node.getStatement(); + + SExpCG cyclesCg = cycles.apply(question.getExpVisitor(), question); + SStmCG stmCg = stm.apply(question.getStmVisitor(), question); + + ACyclesStmCG cycStm = new ACyclesStmCG(); + cycStm.setCycles(cyclesCg); + cycStm.setStm(stmCg); + + return cycStm; + } + + @Override + public SStmCG caseADurationStm(ADurationStm node, IRInfo question) throws AnalysisException + { + PExp duration = node.getDuration(); + PStm stm = node.getStatement(); + + SExpCG durationCg = duration.apply(question.getExpVisitor(), question); + SStmCG stmCg = stm.apply(question.getStmVisitor(), question); + + ADurationStmCG durStm = new ADurationStmCG(); + durStm.setDuration(durationCg); + durStm.setStm(stmCg);; + + return durStm; + } @Override public SStmCG caseALetBeStStm(ALetBeStStm node, IRInfo question) From 6db12e2a5c65d08405d94f894eae961133913e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 21 Sep 2015 16:28:32 +0200 Subject: [PATCH 045/706] Add templates for 'duration' and 'cycles' statement --- .../main/resources/JavaTemplates/Statements/Cycles.vm | 8 ++++++++ .../main/resources/JavaTemplates/Statements/Duration.vm | 8 ++++++++ .../org/overture/codegen/merging/TemplateManager.java | 9 ++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 core/codegen/javagen/src/main/resources/JavaTemplates/Statements/Cycles.vm create mode 100644 core/codegen/javagen/src/main/resources/JavaTemplates/Statements/Duration.vm diff --git a/core/codegen/javagen/src/main/resources/JavaTemplates/Statements/Cycles.vm b/core/codegen/javagen/src/main/resources/JavaTemplates/Statements/Cycles.vm new file mode 100644 index 0000000000..e0d71a2a9c --- /dev/null +++ b/core/codegen/javagen/src/main/resources/JavaTemplates/Statements/Cycles.vm @@ -0,0 +1,8 @@ +## #set( $cycles = $JavaFormat.format($node.getCycles()) ) +#set( $stm = $JavaFormat.format($node.getStm()) ) +## +/* Start of cycles */ +{ + ${stm} +} +/* End of cycles */ \ No newline at end of file diff --git a/core/codegen/javagen/src/main/resources/JavaTemplates/Statements/Duration.vm b/core/codegen/javagen/src/main/resources/JavaTemplates/Statements/Duration.vm new file mode 100644 index 0000000000..fc181f3b00 --- /dev/null +++ b/core/codegen/javagen/src/main/resources/JavaTemplates/Statements/Duration.vm @@ -0,0 +1,8 @@ +## #set( $duration = $JavaFormat.format($node.getDuration()) ) +#set( $stm = $JavaFormat.format($node.getStm()) ) +## +/* Start of duration */ +{ + ${stm} +} +/* End of duration */ \ No newline at end of file diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/merging/TemplateManager.java b/core/codegen/platform/src/main/java/org/overture/codegen/merging/TemplateManager.java index 129170a07c..838fd0450f 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/merging/TemplateManager.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/merging/TemplateManager.java @@ -52,7 +52,9 @@ import org.overture.codegen.cgast.statements.ACallObjectExpStmCG; import org.overture.codegen.cgast.statements.ACallObjectStmCG; import org.overture.codegen.cgast.statements.AContinueStmCG; +import org.overture.codegen.cgast.statements.ACyclesStmCG; import org.overture.codegen.cgast.statements.ADecrementStmCG; +import org.overture.codegen.cgast.statements.ADurationStmCG; import org.overture.codegen.cgast.statements.AErrorStmCG; import org.overture.codegen.cgast.statements.AFieldObjectDesignatorCG; import org.overture.codegen.cgast.statements.AFieldStateDesignatorCG; @@ -385,10 +387,15 @@ protected void initNodeTemplateFileNames() nodeTemplateFileNames.put(AMetaStmCG.class, templateStructure.STM_PATH + "Meta"); - // The template used for the block statement also works here nodeTemplateFileNames.put(AAtomicStmCG.class, templateStructure.STM_PATH + "Atomic"); + nodeTemplateFileNames.put(ACyclesStmCG.class, templateStructure.STM_PATH + + "Cycles"); + + nodeTemplateFileNames.put(ADurationStmCG.class, templateStructure.STM_PATH + + "Duration"); + // Expressions nodeTemplateFileNames.put(AApplyExpCG.class, templateStructure.EXP_PATH From 70a98771775e10e023cec12e34f47f4c9c0cdd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 21 Sep 2015 16:30:12 +0200 Subject: [PATCH 046/706] Test cycles statement generation --- .../src/test/resources/rt/CyclesSimple.vdmrt | 14 +++++ .../rt/CyclesSimple.vdmrt.eval.result | 6 ++ .../resources/rt/CyclesSimple.vdmrt.result | 55 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt create mode 100644 core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt.eval.result create mode 100644 core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt.result diff --git a/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt b/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt new file mode 100644 index 0000000000..2256d459f5 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt @@ -0,0 +1,14 @@ +class Entry + +operations + +public static Run : () ==> ? +Run () == +let a = 1 +in + cycles(a + a) + ( + return a; + ); + +end Entry \ No newline at end of file diff --git a/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt.eval.result b/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt.eval.result new file mode 100644 index 0000000000..51a7478c90 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt.eval.result @@ -0,0 +1,6 @@ + + + + + + diff --git a/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt.result b/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt.result new file mode 100644 index 0000000000..cf3c62d1e6 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/rt/CyclesSimple.vdmrt.result @@ -0,0 +1,55 @@ +import org.overture.codegen.runtime.*; + +import java.util.*; + + +@SuppressWarnings("all") +public class Entry implements EvaluatePP { + public volatile Sentinel sentinel; + + public Entry() { + sentinel = new Entry_sentinel(this); + } + + public static Object Run() { + Number a = 1L; + /* Start of cycles */ + { + return a; + } + + /* End of cycles */ + } + + public String toString() { + return "Entry{}"; + } + + public Boolean evaluatePP(final Number fnr) { + if (Utils.equals(fnr, 0L)) { + return true; + } else if (Utils.equals(fnr, 1L)) { + return true; + } else if (Utils.equals(fnr, 2L)) { + return true; + } else { + return true; + } + } + + public static class Entry_sentinel extends Sentinel { + public static final int Run = 0; + public static final int Entry = 1; + public static final int toString = 2; + public final int function_sum = 3; + + public Entry_sentinel() { + } + + public Entry_sentinel(final EvaluatePP instance) { + init(instance, function_sum); + } + } +} + +########## From 06ec3d0c301ae00c229a1efd82a84f0eed324ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 21 Sep 2015 16:30:27 +0200 Subject: [PATCH 047/706] Test 'duration' statement generation --- .../test/resources/rt/DurationSimple.vdmrt | 14 +++++ .../rt/DurationSimple.vdmrt.eval.result | 6 ++ .../resources/rt/DurationSimple.vdmrt.result | 55 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt create mode 100644 core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt.eval.result create mode 100644 core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt.result diff --git a/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt b/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt new file mode 100644 index 0000000000..04c45caa88 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt @@ -0,0 +1,14 @@ +class Entry + +operations + +public static Run : () ==> ? +Run () == +let a = 1 +in + duration(a + a) + ( + return a; + ); + +end Entry \ No newline at end of file diff --git a/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt.eval.result b/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt.eval.result new file mode 100644 index 0000000000..0569088766 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt.eval.result @@ -0,0 +1,6 @@ + + + + + + diff --git a/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt.result b/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt.result new file mode 100644 index 0000000000..6e726e1809 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/rt/DurationSimple.vdmrt.result @@ -0,0 +1,55 @@ +import org.overture.codegen.runtime.*; + +import java.util.*; + + +@SuppressWarnings("all") +public class Entry implements EvaluatePP { + public volatile Sentinel sentinel; + + public Entry() { + sentinel = new Entry_sentinel(this); + } + + public static Object Run() { + Number a = 1L; + /* Start of duration */ + { + return a; + } + + /* End of duration */ + } + + public String toString() { + return "Entry{}"; + } + + public Boolean evaluatePP(final Number fnr) { + if (Utils.equals(fnr, 0L)) { + return true; + } else if (Utils.equals(fnr, 1L)) { + return true; + } else if (Utils.equals(fnr, 2L)) { + return true; + } else { + return true; + } + } + + public static class Entry_sentinel extends Sentinel { + public static final int Run = 0; + public static final int Entry = 1; + public static final int toString = 2; + public final int function_sum = 3; + + public Entry_sentinel() { + } + + public Entry_sentinel(final EvaluatePP instance) { + init(instance, function_sum); + } + } +} + +########## From 100025d215775f2c781485d88ec5fc63974c12fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 21 Sep 2015 16:33:54 +0200 Subject: [PATCH 048/706] Update Java code generator to accept RT models --- .../codegen/vdm2java/JavaCodeGen.java | 7 ++++++- .../codegen/vdm2java/JavaCodeGenMain.java | 21 +++++++++++++++---- .../codegen/vdm2java/JavaCodeGenUtil.java | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java index c90991adf1..0e26866f6a 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java @@ -32,6 +32,8 @@ import org.apache.velocity.app.Velocity; import org.overture.ast.analysis.AnalysisException; +import org.overture.ast.definitions.ACpuClassDefinition; +import org.overture.ast.definitions.ASystemClassDefinition; import org.overture.ast.definitions.PDefinition; import org.overture.ast.definitions.SClassDefinition; import org.overture.ast.definitions.SFunctionDefinition; @@ -273,7 +275,10 @@ private GeneratedData generateVdmFromNodes(List ast, for (INode node : ast) { - genIrStatus(statuses, node); + if(!(node instanceof ASystemClassDefinition) && !(node instanceof ACpuClassDefinition)) + { + genIrStatus(statuses, node); + } } List generated = new LinkedList(); diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenMain.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenMain.java index eb5b27d7b2..2a82ccb8dd 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenMain.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenMain.java @@ -50,6 +50,7 @@ public class JavaCodeGenMain { public static final String OO_ARG = "-pp"; + public static final String RT_ARG = "-rt"; public static final String SL_ARG = "-sl"; public static final String CLASSIC = "-classic"; public static final String VDM10 = "-vdm10"; @@ -64,7 +65,6 @@ public class JavaCodeGenMain public static void main(String[] args) { Settings.release = Release.VDM_10; - Dialect dialect = Dialect.VDM_PP; JavaCodeGenMode cgMode = null; boolean printClasses = false; @@ -101,6 +101,11 @@ public static void main(String[] args) cgMode = JavaCodeGenMode.OO_SPEC; Settings.dialect = Dialect.VDM_PP; } + else if(arg.equals(RT_ARG)) + { + cgMode = JavaCodeGenMode.OO_SPEC; + Settings.dialect = Dialect.VDM_RT; + } else if(arg.equals(SL_ARG)) { cgMode = JavaCodeGenMode.SL_SPEC; @@ -212,7 +217,7 @@ else if(arg.equals(NO_CODE_FORMAT)) if(cgMode == JavaCodeGenMode.EXP) { - handleExp(exp, irSettings, javaSettings, dialect); + handleExp(exp, irSettings, javaSettings, Settings.dialect); } else { @@ -228,7 +233,7 @@ else if(arg.equals(NO_CODE_FORMAT)) } if (cgMode == JavaCodeGenMode.OO_SPEC) { - handleOo(files, irSettings, javaSettings, dialect, + handleOo(files, irSettings, javaSettings, Settings.dialect, printClasses, outputDir); } else if(cgMode == JavaCodeGenMode.SL_SPEC) { handleSl(files, irSettings, javaSettings, printClasses, @@ -324,7 +329,15 @@ public static void handleOo(List files, IRSettings irSettings, vdmCodGen.setSettings(irSettings); vdmCodGen.setJavaSettings(javaSettings); - TypeCheckResult> tcResult = TypeCheckerUtil.typeCheckPp(files); + TypeCheckResult> tcResult = null; + + if (dialect == Dialect.VDM_PP) + { + tcResult = TypeCheckerUtil.typeCheckPp(files); + } else + { + tcResult = TypeCheckerUtil.typeCheckRt(files); + } if(GeneralCodeGenUtils.hasErrors(tcResult)) { diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenUtil.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenUtil.java index e27244c379..5ea31eb6fe 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenUtil.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenUtil.java @@ -375,7 +375,7 @@ else if(generatedClass.getIrNode() instanceof AInterfaceDeclCG) public static boolean isSupportedVdmSourceFile(File f) { - String[] extensions = new String[]{".vdmpp", ".vpp", ".vsl", ".vdmsl"}; + String[] extensions = new String[]{".vdmpp", ".vpp", ".vsl", ".vdmsl", ".vdmrt", ".vrt"}; for(String ext : extensions) { From 2437435da45fe3269993bed48693fb91db696e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 22 Sep 2015 15:54:48 +0200 Subject: [PATCH 049/706] Add default reason for unsupported nodes --- .../java/org/overture/codegen/visitor/AbstractVisitorCG.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/AbstractVisitorCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/AbstractVisitorCG.java index 24f5fa4f78..43613921da 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/AbstractVisitorCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/AbstractVisitorCG.java @@ -38,7 +38,7 @@ public A defaultINode(INode node, Q question) throws AnalysisException return null; } - question.addUnsupportedNode(node); + question.addUnsupportedNode(node, "Node is currently not supported by the IR generator"); return null; } From 836cdc7e724ebe21d21bea36014022f316076e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 22 Sep 2015 15:58:35 +0200 Subject: [PATCH 050/706] Move definition table computation into IR generator --- .../codegen/vdm2java/JavaCodeGen.java | 20 +------------ .../org/overture/codegen/ir/CodeGenBase.java | 4 +-- .../org/overture/codegen/ir/IRGenerator.java | 29 +++++++++++++++++++ .../java/org/overture/codegen/ir/IRInfo.java | 1 + 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java index 0e26866f6a..073e7ce810 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java @@ -45,7 +45,6 @@ import org.overture.ast.statements.AIdentifierStateDesignator; import org.overture.ast.statements.ANotYetSpecifiedStm; import org.overture.ast.util.modules.CombinedDefaultModule; -import org.overture.codegen.analysis.vdm.IdStateDesignatorDefCollector; import org.overture.codegen.analysis.vdm.NameCollector; import org.overture.codegen.analysis.vdm.Renaming; import org.overture.codegen.analysis.vdm.UnreachableStmRemover; @@ -255,7 +254,7 @@ private GeneratedData generateVdmFromNodes(List ast, handleOldNames(ast); List allRenamings = normaliseIdentifiers(userModules); - computeDefTable(userModules); + generator.computeDefTable(userModules); // To document any renaming of variables shadowing other variables removeUnreachableStms(ast); @@ -593,23 +592,6 @@ private List normaliseIdentifiers( return new LinkedList(filteredRenamings); } - private void computeDefTable(List mergedParseLists) - throws AnalysisException - { - List classesToConsider = new LinkedList<>(); - - for (INode node : mergedParseLists) - { - if (!getInfo().getDeclAssistant().isLibrary(node)) - { - classesToConsider.add(node); - } - } - - Map idDefs = IdStateDesignatorDefCollector.getIdDefs(classesToConsider, getInfo().getTcFactory()); - getInfo().setIdStateDesignatorDefs(idDefs); - } - private void removeUnreachableStms(List mergedParseLists) throws AnalysisException { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/CodeGenBase.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/CodeGenBase.java index 12bb76fb0c..fcd885859f 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/CodeGenBase.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/CodeGenBase.java @@ -5,15 +5,13 @@ public class CodeGenBase { - public static final String OBJ_INIT_CALL_NAME_PREFIX = "cg_init_"; - protected IRGenerator generator; protected TransAssistantCG transAssistant; protected CodeGenBase() { super(); - this.generator = new IRGenerator(OBJ_INIT_CALL_NAME_PREFIX); + this.generator = new IRGenerator(); } public void setIRGenerator(IRGenerator generator) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java index 19b11202d0..a1b4e89be1 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java @@ -22,13 +22,18 @@ package org.overture.codegen.ir; import java.util.HashSet; +import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Set; import org.overture.ast.analysis.AnalysisException; +import org.overture.ast.definitions.PDefinition; import org.overture.ast.definitions.SClassDefinition; import org.overture.ast.expressions.PExp; import org.overture.ast.modules.AModuleModules; +import org.overture.ast.statements.AIdentifierStateDesignator; +import org.overture.codegen.analysis.vdm.IdStateDesignatorDefCollector; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.declarations.AClassDeclCG; @@ -37,12 +42,36 @@ public class IRGenerator { + private static final String OBJ_INIT_CALL_NAME_PREFIX = "cg_init_"; + protected IRInfo codeGenInfo; + public IRGenerator() + { + this(OBJ_INIT_CALL_NAME_PREFIX); + } + public IRGenerator(String objectInitCallPrefix) { this.codeGenInfo = new IRInfo(objectInitCallPrefix); } + + public void computeDefTable(List mergedParseLists) + throws AnalysisException + { + List classesToConsider = new LinkedList<>(); + + for (org.overture.ast.node.INode node : mergedParseLists) + { + if (!codeGenInfo.getDeclAssistant().isLibrary(node)) + { + classesToConsider.add(node); + } + } + + Map idDefs = IdStateDesignatorDefCollector.getIdDefs(classesToConsider, codeGenInfo.getTcFactory()); + codeGenInfo.setIdStateDesignatorDefs(idDefs); + } public void clear() { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java index 3e8e4c11e2..c4ed4a076c 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java @@ -344,6 +344,7 @@ public void clear() unsupportedNodes.clear(); transformationWarnings.clear(); tempVarNameGen.clear(); + idStateDesignatorDefs.clear(); } public IRSettings getSettings() From 8bd4872e330316d3ac28b0ff9b6dbcb028c175a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 22 Sep 2015 16:58:51 +0200 Subject: [PATCH 051/706] Prepare for different types of IR classes --- core/codegen/ir/src/main/resources/cg.astv2 | 42 +++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/core/codegen/ir/src/main/resources/cg.astv2 b/core/codegen/ir/src/main/resources/cg.astv2 index 86b868b871..0895e1488a 100644 --- a/core/codegen/ir/src/main/resources/cg.astv2 +++ b/core/codegen/ir/src/main/resources/cg.astv2 @@ -157,25 +157,7 @@ CG {-> package='org.overture.codegen.cgast' [type]:CG.#type [name]:java_String [initial]:CG.#exp - | {class} - (globalMetaData):eString* - [package]:java_String - [access]:java_String - [abstract]:java_Boolean - [static]:java_Boolean - [name]:java_String - [fields]:field* - [invariant]:CG.#decl - [methods]:CG.#decl.method* - [functions]:CG.#decl.func* - [traces]:CG.#decl.namedTrace* - [superName]:java_String - [thread]:CG.#decl.thread - [innerClasses]:CG.#decl.class* - [interfaces]:CG.#decl.interface* - [typeDecls]:CG.#decl.type* - [perSyncs]:CG.#decl.persync* - [mutexSyncs]:CG.#decl.mutexSync* + | #Class | {module} [name]:java_String [import]:CG.#imports.module @@ -237,6 +219,28 @@ CG {-> package='org.overture.codegen.cgast' [terms]:CG.#term.traceDecl* ; +#Class {-> package='org.overture.codegen.cgast.declarations' + | (globalMetaData):eString* + | [package]:java_String + | [access]:java_String + | [abstract]:java_Boolean + | [static]:java_Boolean + | [name]:java_String + | [fields]:field* + | [invariant]:CG.#decl + | [methods]:CG.#decl.method* + | [functions]:CG.#decl.func* + | [traces]:CG.#decl.namedTrace* + | [superName]:java_String + | [thread]:CG.#decl.thread + | [innerClasses]:CG.#decl.class* + | [interfaces]:CG.#decl.interface* + | [typeDecls]:CG.#decl.type* + | [perSyncs]:CG.#decl.persync* + | [mutexSyncs]:CG.#decl.mutexSync*} + = {default} + ; + #stateDesignator {-> package='org.overture.codegen.cgast.statements' | [type]:CG.#type } = {identifier} [name]:java_String [explicit]:java_Boolean [className]:java_String [isLocal]:java_Boolean From 8909bcdcf1cb685a23eaa1162a3324865c7bbd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 22 Sep 2015 17:00:44 +0200 Subject: [PATCH 052/706] Update IR class names due to restructuring --- .../codegen/vdm2java/JavaClassCreator.java | 4 +- .../codegen/vdm2java/JavaCodeGen.java | 22 +++++----- .../codegen/vdm2java/JavaCodeGenUtil.java | 10 ++--- .../overture/codegen/vdm2java/JavaFormat.java | 20 ++++----- .../codegen/vdm2java/JavaFormatAssistant.java | 6 +-- .../codegen/vdm2java/JavaMainTag.java | 6 +-- .../vdm2java/JavaQuoteValueCreator.java | 6 +-- .../codegen/vdm2java/JavaRecordCreator.java | 8 ++-- .../codegen/vdm2java/JavaToStringTrans.java | 4 +- .../codegen/vdm2java/JavaValueSemantics.java | 6 +-- .../codegen/vdm2java/RecMethodsTrans.java | 4 +- .../codegen/assistant/DeclAssistantCG.java | 42 +++++++++---------- .../codegen/assistant/DeclStrategy.java | 4 +- .../codegen/assistant/StmAssistantCG.java | 4 +- .../codegen/assistant/TypeAssistantCG.java | 16 +++---- .../org/overture/codegen/ir/IRAnalysis.java | 8 ++-- .../org/overture/codegen/ir/IRGenerator.java | 4 +- .../java/org/overture/codegen/ir/IRInfo.java | 16 +++---- .../codegen/merging/TemplateManager.java | 4 +- .../codegen/traces/TraceStmsBuilder.java | 6 +-- .../overture/codegen/traces/TracesTrans.java | 8 ++-- .../trans/ModuleToClassTransformation.java | 8 ++-- .../overture/codegen/trans/PrePostTrans.java | 4 +- .../codegen/trans/conc/EvalPermPredTrans.java | 4 +- .../trans/conc/MainClassConcTrans.java | 14 +++---- .../codegen/trans/conc/MutexDeclTrans.java | 4 +- .../codegen/trans/conc/SentinelTrans.java | 6 +-- .../trans/conv/ObjectDesignatorToExpCG.java | 4 +- .../codegen/trans/letexps/FuncTrans.java | 6 +-- .../trans/uniontypes/UnionTypeTrans.java | 8 ++-- .../codegen/visitor/ClassVisitorCG.java | 10 ++--- .../codegen/visitor/VisitorManager.java | 8 ++-- .../codegen/vdm2jml/InvAssertionTrans.java | 4 +- .../codegen/vdm2jml/JmlAnnotationHelper.java | 8 ++-- .../overture/codegen/vdm2jml/JmlGenUtil.java | 30 ++++++------- .../codegen/vdm2jml/JmlGenerator.java | 24 +++++------ .../org/overture/codegen/vdm2jml/NameGen.java | 4 +- .../codegen/vdm2jml/NamedTypeInvHandler.java | 18 ++++---- .../codegen/vdm2jml/RecInvTransformation.java | 4 +- .../codegen/vdm2jml/StateDesInfo.java | 6 +-- .../vdm2jml/util/AnnotationSorter.java | 6 +-- .../vdm2jml/tests/AnnotationTestsBase.java | 20 ++++----- .../overture/vdm2jml/tests/NameGenTests.java | 4 +- .../overture/vdm2jml/tests/RecInvTests.java | 8 ++-- 44 files changed, 210 insertions(+), 210 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaClassCreator.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaClassCreator.java index a1448ab7e6..2094cf744e 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaClassCreator.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaClassCreator.java @@ -3,7 +3,7 @@ import java.util.LinkedList; import org.overture.codegen.cgast.SExpCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; @@ -23,7 +23,7 @@ public JavaClassCreator(IRInfo info) this.info = info; } - public AMethodDeclCG generateToString(AClassDeclCG classDecl) + public AMethodDeclCG generateToString(ADefaultClassDeclCG classDecl) { //Example: A{#32, x := 4, c = "STD"} (ID is omitted) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java index 073e7ce810..69247d30b9 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java @@ -60,7 +60,7 @@ import org.overture.codegen.assistant.DeclAssistantCG; import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AInterfaceDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; import org.overture.codegen.ir.CodeGenBase; @@ -188,7 +188,7 @@ public List generateJavaFromVdmQuotes() List modules = new LinkedList(); for (String quoteNameVdm : quoteValues) { - AClassDeclCG quoteDecl = quoteValueCreator.consQuoteValue(quoteNameVdm + ADefaultClassDeclCG quoteDecl = quoteValueCreator.consQuoteValue(quoteNameVdm + JAVA_QUOTE_NAME_SUFFIX, quoteNameVdm, getJavaSettings().getJavaRootPackage()); StringWriter writer = new StringWriter(); @@ -308,20 +308,20 @@ private GeneratedData generateVdmFromNodes(List ast, } - List> classStatuses = IRStatus.extract(modulesAsNodes, AClassDeclCG.class); - classStatuses.addAll(IRStatus.extract(statuses, AClassDeclCG.class)); + List> classStatuses = IRStatus.extract(modulesAsNodes, ADefaultClassDeclCG.class); + classStatuses.addAll(IRStatus.extract(statuses, ADefaultClassDeclCG.class)); if (getJavaSettings().getJavaRootPackage() != null) { - for (IRStatus irStatus : classStatuses) + for (IRStatus irStatus : classStatuses) { irStatus.getIrNode().setPackage(getJavaSettings().getJavaRootPackage()); } } - List> canBeGenerated = new LinkedList>(); + List> canBeGenerated = new LinkedList>(); - for (IRStatus status : classStatuses) + for (IRStatus status : classStatuses) { if (status.canBeGenerated()) { @@ -336,7 +336,7 @@ private GeneratedData generateVdmFromNodes(List ast, for (DepthFirstAnalysisAdaptor trans : transformations) { - for (IRStatus status : canBeGenerated) + for (IRStatus status : canBeGenerated) { try { @@ -356,7 +356,7 @@ private GeneratedData generateVdmFromNodes(List ast, } // Event notification - canBeGenerated = IRStatus.extract(finalIrEvent(IRStatus.extract(canBeGenerated)), AClassDeclCG.class); + canBeGenerated = IRStatus.extract(finalIrEvent(IRStatus.extract(canBeGenerated)), ADefaultClassDeclCG.class); canBeGenerated = filter(canBeGenerated, generated); List skipping = new LinkedList(); @@ -364,10 +364,10 @@ private GeneratedData generateVdmFromNodes(List ast, MergeVisitor mergeVisitor = javaFormat.getMergeVisitor(); javaFormat.setFunctionValueAssistant(transSeries.getFuncValAssist()); - for (IRStatus status : canBeGenerated) + for (IRStatus status : canBeGenerated) { StringWriter writer = new StringWriter(); - AClassDeclCG classCg = status.getIrNode(); + ADefaultClassDeclCG classCg = status.getIrNode(); String className = status.getIrNodeName(); INode vdmClass = status.getIrNode().getSourceNode().getVdmNode(); diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenUtil.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenUtil.java index 5ea31eb6fe..c284bf677d 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenUtil.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGenUtil.java @@ -34,7 +34,7 @@ import org.overture.ast.analysis.AnalysisException; import org.overture.ast.expressions.PExp; import org.overture.ast.lex.Dialect; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AInterfaceDeclCG; import org.overture.codegen.ir.IRSettings; import org.overture.codegen.logging.Logger; @@ -161,9 +161,9 @@ public static void saveJavaClass(File outputFolder, String javaFileName, public static boolean isQuote(org.overture.codegen.cgast.INode decl, JavaSettings settings) { - if(decl instanceof AClassDeclCG) + if(decl instanceof ADefaultClassDeclCG) { - AClassDeclCG clazz = (AClassDeclCG) decl; + ADefaultClassDeclCG clazz = (ADefaultClassDeclCG) decl; if(clazz.getPackage() == null) { @@ -347,9 +347,9 @@ public static File getModuleOutputDir(File outputDir, JavaCodeGen vdmCodGen, File moduleOutputDir = outputDir; String javaPackage = vdmCodGen.getJavaSettings().getJavaRootPackage(); - if(generatedClass.getIrNode() instanceof AClassDeclCG) + if(generatedClass.getIrNode() instanceof ADefaultClassDeclCG) { - javaPackage = ((AClassDeclCG) generatedClass.getIrNode()).getPackage(); + javaPackage = ((ADefaultClassDeclCG) generatedClass.getIrNode()).getPackage(); } else if(generatedClass.getIrNode() instanceof AInterfaceDeclCG) { diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java index 5434f599bb..1ef0516b6c 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java @@ -36,7 +36,7 @@ import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AInterfaceDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; @@ -376,7 +376,7 @@ public String formatTypeName(INode node, ATypeNameCG typeName) return typeNameStr; } - AClassDeclCG classDef = node.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG classDef = node.getAncestor(ADefaultClassDeclCG.class); String definingClass = typeName.getDefiningClass() != null && classDef != null @@ -613,13 +613,13 @@ public String format(List params) return writer.toString(); } - public String formatSuperType(AClassDeclCG classDecl) + public String formatSuperType(ADefaultClassDeclCG classDecl) { return classDecl.getSuperName() == null ? "" : "extends " + classDecl.getSuperName(); } - public String formatInterfaces(AClassDeclCG classDecl) + public String formatInterfaces(ADefaultClassDeclCG classDecl) { LinkedList interfaces = classDecl.getInterfaces(); @@ -885,12 +885,12 @@ public String escapeChar(char c) : c + ""; } - public boolean isInnerClass(AClassDeclCG node) + public boolean isInnerClass(ADefaultClassDeclCG node) { - return node.parent() != null && node.parent().getAncestor(AClassDeclCG.class) != null; + return node.parent() != null && node.parent().getAncestor(ADefaultClassDeclCG.class) != null; } - public static boolean isQuote(AClassDeclCG classCg) + public static boolean isQuote(ADefaultClassDeclCG classCg) { return classCg != null && "quotes".equals(classCg.getPackage()); } @@ -936,12 +936,12 @@ public static boolean isScoped(ABlockStmCG block) return block != null && block.getScoped() != null && block.getScoped(); } - public boolean importTraceSupport(AClassDeclCG node) + public boolean importTraceSupport(ADefaultClassDeclCG node) { return info.getSettings().generateTraces() && !node.getTraces().isEmpty(); } - public static boolean isMainClass(AClassDeclCG clazz) + public static boolean isMainClass(ADefaultClassDeclCG clazz) { return clazz != null && clazz.getTag() instanceof JavaMainTag; } @@ -960,7 +960,7 @@ public String getQuotePackagePrefix() } } - public boolean genClassInvariant(AClassDeclCG clazz) + public boolean genClassInvariant(ADefaultClassDeclCG clazz) { if(!info.getSettings().generateInvariants()) { diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormatAssistant.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormatAssistant.java index 1aacb3072c..22d3469475 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormatAssistant.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormatAssistant.java @@ -26,7 +26,7 @@ import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; @@ -60,7 +60,7 @@ public JavaFormatAssistant(IRInfo info) public ATypeNameCG consTypeName(ARecordDeclCG record) throws AnalysisException { - AClassDeclCG classDef = record.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG classDef = record.getAncestor(ADefaultClassDeclCG.class); ATypeNameCG typeName = new ATypeNameCG(); @@ -124,7 +124,7 @@ public AInstanceofExpCG consInstanceOf(ARecordDeclCG record, { // Example: objRef instanceof classType - AClassDeclCG enclosingClass = record.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = record.getAncestor(ADefaultClassDeclCG.class); ATypeNameCG typeName = new ATypeNameCG(); typeName.setDefiningClass(enclosingClass.getName()); diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaMainTag.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaMainTag.java index a020a84e53..ffbf812e70 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaMainTag.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaMainTag.java @@ -1,6 +1,6 @@ package org.overture.codegen.vdm2java; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.types.AVoidTypeCG; @@ -9,12 +9,12 @@ public class JavaMainTag { private boolean isVoidRun; - public JavaMainTag(AClassDeclCG classCg) + public JavaMainTag(ADefaultClassDeclCG classCg) { checkRunReturnType(classCg); } - private void checkRunReturnType(AClassDeclCG classCg) + private void checkRunReturnType(ADefaultClassDeclCG classCg) { isVoidRun = false; for(AMethodDeclCG m : classCg.getMethods()) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java index fdf6647638..8cc0ae47a8 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java @@ -2,7 +2,7 @@ import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; @@ -43,9 +43,9 @@ public JavaQuoteValueCreator(IRInfo info, TransAssistantCG transformationAssista this.transAssistant = transformationAssistant; } - public AClassDeclCG consQuoteValue(String quoteClassName, String quoteName, String userCodePackage) + public ADefaultClassDeclCG consQuoteValue(String quoteClassName, String quoteName, String userCodePackage) { - AClassDeclCG decl = new AClassDeclCG(); + ADefaultClassDeclCG decl = new ADefaultClassDeclCG(); decl.setAbstract(false); decl.setAccess(IJavaConstants.PUBLIC); decl.setName(quoteClassName); diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaRecordCreator.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaRecordCreator.java index 2fab2c621d..9b319fbcfb 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaRecordCreator.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaRecordCreator.java @@ -28,7 +28,7 @@ import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; @@ -138,7 +138,7 @@ public AMethodDeclCG genCopyMethod(ARecordDeclCG record) throws AnalysisException { - AClassDeclCG defClass = record.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG defClass = record.getAncestor(ADefaultClassDeclCG.class); ATypeNameCG typeName = new ATypeNameCG(); typeName.setDefiningClass(defClass.getName()); typeName.setName(record.getName()); @@ -269,7 +269,7 @@ public AMethodDeclCG genToStringMethod(ARecordDeclCG record) AReturnStmCG returnStm = new AReturnStmCG(); - AClassDeclCG enclosingClass = record.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = record.getAncestor(ADefaultClassDeclCG.class); String className = ""; if(enclosingClass != null) @@ -310,7 +310,7 @@ public AMethodDeclCG genToStringMethod(ARecordDeclCG record) public ARecordTypeCG consRecordType(ARecordDeclCG record) { - AClassDeclCG defClass = record.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG defClass = record.getAncestor(ADefaultClassDeclCG.class); ATypeNameCG typeName = new ATypeNameCG(); typeName.setDefiningClass(defClass.getName()); typeName.setName(record.getName()); diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaToStringTrans.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaToStringTrans.java index 066db3d1a7..7a43732fbb 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaToStringTrans.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaToStringTrans.java @@ -2,7 +2,7 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.ir.IRInfo; public class JavaToStringTrans extends DepthFirstAnalysisAdaptor @@ -15,7 +15,7 @@ public JavaToStringTrans(IRInfo info) } @Override - public void caseAClassDeclCG(AClassDeclCG node) throws AnalysisException + public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisException { node.getMethods().add(creator.generateToString(node)); } diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaValueSemantics.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaValueSemantics.java index 0f58c43849..e6f9627b1c 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaValueSemantics.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaValueSemantics.java @@ -28,7 +28,7 @@ import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.expressions.AAddrEqualsBinaryExpCG; @@ -186,7 +186,7 @@ public boolean cloneMember(AFieldExpCG exp) String memberName = exp.getMemberName(); - List classes = javaFormat.getIrInfo().getClasses(); + List classes = javaFormat.getIrInfo().getClasses(); AssistantManager assistantManager = javaFormat.getIrInfo().getAssistantManager(); AFieldDeclCG memberField = assistantManager.getDeclAssistant().getFieldDecl(classes, recordType, memberName); @@ -277,7 +277,7 @@ public boolean shouldClone(SExpCG exp) private boolean inRecClassNonConstructor(SExpCG exp) { - AClassDeclCG encClass = exp.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG encClass = exp.getAncestor(ADefaultClassDeclCG.class); if(encClass != null) { diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/RecMethodsTrans.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/RecMethodsTrans.java index 921984ca47..5d1901c628 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/RecMethodsTrans.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/RecMethodsTrans.java @@ -2,7 +2,7 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; import org.overture.codegen.cgast.declarations.ATypeDeclCG; @@ -16,7 +16,7 @@ public RecMethodsTrans(JavaRecordCreator recCreator) } @Override - public void caseAClassDeclCG(AClassDeclCG node) throws AnalysisException + public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisException { for(ATypeDeclCG typeDecl : node.getTypeDecls()) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java index 4235b70c89..a1fd2a42eb 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java @@ -50,7 +50,7 @@ import org.overture.codegen.cgast.SPatternCG; import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AFuncDeclCG; @@ -170,8 +170,8 @@ public boolean isLibraryName(String className) return false; } - public List getAllDecls(AClassDeclCG classDecl, - List classes, DeclStrategy strategy) + public List getAllDecls(ADefaultClassDeclCG classDecl, + List classes, DeclStrategy strategy) { List allDecls = new LinkedList(); @@ -181,7 +181,7 @@ public List getAllDecls(AClassDeclCG classDecl, while (superName != null) { - AClassDeclCG superClassDecl = findClass(classes, superName); + ADefaultClassDeclCG superClassDecl = findClass(classes, superName); if(superClassDecl == null) { @@ -204,8 +204,8 @@ public List getAllDecls(AClassDeclCG classDecl, return allDecls; } - public List getAllMethods(AClassDeclCG classDecl, - List classes) + public List getAllMethods(ADefaultClassDeclCG classDecl, + List classes) { DeclStrategy methodDeclStrategy = new DeclStrategy() { @@ -216,7 +216,7 @@ public String getAccess(AMethodDeclCG decl) } @Override - public List getDecls(AClassDeclCG classDecl) + public List getDecls(ADefaultClassDeclCG classDecl) { return classDecl.getMethods(); } @@ -225,8 +225,8 @@ public List getDecls(AClassDeclCG classDecl) return getAllDecls(classDecl, classes, methodDeclStrategy); } - public List getAllFields(AClassDeclCG classDecl, - List classes) + public List getAllFields(ADefaultClassDeclCG classDecl, + List classes) { DeclStrategy fieldDeclStrategy = new DeclStrategy() { @@ -237,7 +237,7 @@ public String getAccess(AFieldDeclCG decl) } @Override - public List getDecls(AClassDeclCG classDecl) + public List getDecls(ADefaultClassDeclCG classDecl) { return classDecl.getFields(); } @@ -268,9 +268,9 @@ public void setLocalDefs(List localDefs, } } - public AClassDeclCG findClass(List classes, String moduleName) + public ADefaultClassDeclCG findClass(List classes, String moduleName) { - for (AClassDeclCG classDecl : classes) + for (ADefaultClassDeclCG classDecl : classes) { if (classDecl.getName().equals(moduleName)) { @@ -282,7 +282,7 @@ public AClassDeclCG findClass(List classes, String moduleName) } // This method assumes that the record is defined in definingClass and not a super class - public ARecordDeclCG findRecord(AClassDeclCG definingClass, + public ARecordDeclCG findRecord(ADefaultClassDeclCG definingClass, String recordName) { for (ATypeDeclCG typeDecl : definingClass.getTypeDecls()) @@ -306,7 +306,7 @@ public ARecordDeclCG findRecord(AClassDeclCG definingClass, } // This method assumes that the record is defined in definingClass and not a super class - public List getRecords(AClassDeclCG definingClass) + public List getRecords(ADefaultClassDeclCG definingClass) { List records = new LinkedList(); @@ -327,10 +327,10 @@ public List getRecords(AClassDeclCG definingClass) return records; } - public ARecordDeclCG findRecord(List classes, + public ARecordDeclCG findRecord(List classes, ARecordTypeCG recordType) { - AClassDeclCG definingClass = findClass(classes, recordType.getName().getDefiningClass()); + ADefaultClassDeclCG definingClass = findClass(classes, recordType.getName().getDefiningClass()); ARecordDeclCG record = findRecord(definingClass, recordType.getName().getName()); return record; @@ -486,7 +486,7 @@ else if (typeCg instanceof ARealNumericBasicTypeCG) } } - public AFieldDeclCG getFieldDecl(List classes, + public AFieldDeclCG getFieldDecl(List classes, ARecordTypeCG recordType, int number) { ARecordDeclCG record = findRecord(classes, recordType); @@ -494,7 +494,7 @@ public AFieldDeclCG getFieldDecl(List classes, return record.getFields().get(number); } - public AFieldDeclCG getFieldDecl(AClassDeclCG clazz, String fieldName) + public AFieldDeclCG getFieldDecl(ADefaultClassDeclCG clazz, String fieldName) { for(AFieldDeclCG field : clazz.getFields()) { @@ -507,7 +507,7 @@ public AFieldDeclCG getFieldDecl(AClassDeclCG clazz, String fieldName) return null; } - public AFieldDeclCG getFieldDecl(List classes, + public AFieldDeclCG getFieldDecl(List classes, ARecordTypeCG recordType, String memberName) { ATypeNameCG name = recordType.getName(); @@ -534,8 +534,8 @@ public AFieldDeclCG getFieldDecl(List classes, + recordType); } - AClassDeclCG definingClass = null; - for (AClassDeclCG currentClass : classes) + ADefaultClassDeclCG definingClass = null; + for (ADefaultClassDeclCG currentClass : classes) { if (currentClass.getName().equals(definingClassName)) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclStrategy.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclStrategy.java index 054e719dd9..f321d6502e 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclStrategy.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclStrategy.java @@ -24,11 +24,11 @@ import java.util.List; import org.overture.codegen.cgast.SDeclCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; public interface DeclStrategy { public String getAccess(T decl); - public List getDecls(AClassDeclCG classDecl); + public List getDecls(ADefaultClassDeclCG classDecl); } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/StmAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/StmAssistantCG.java index 1e1111b7fd..d4c0b0ce2f 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/StmAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/StmAssistantCG.java @@ -38,7 +38,7 @@ import org.overture.ast.types.PType; import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; import org.overture.codegen.cgast.statements.AAtomicStmCG; @@ -113,7 +113,7 @@ public boolean inAtomic(SStmCG stm) public String getSuperClassName(ASuperCallStmCG stm) { - AClassDeclCG enclosingClass = stm.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = stm.getAncestor(ADefaultClassDeclCG.class); return enclosingClass.getName(); } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java index 3e428d1efd..03e57b94a5 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java @@ -44,7 +44,7 @@ import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.SObjectDesignatorCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; @@ -107,7 +107,7 @@ public STypeCG getFieldExpType(IRInfo info, String fieldName, String fieldModule if (fieldModule != null) { // It is a class - AClassDeclCG clazz = info.getDeclAssistant().findClass(info.getClasses(), fieldModule); + ADefaultClassDeclCG clazz = info.getDeclAssistant().findClass(info.getClasses(), fieldModule); AFieldDeclCG field = info.getDeclAssistant().getFieldDecl(clazz, fieldModule); if(field != null) @@ -163,7 +163,7 @@ public AMethodTypeCG getMethodType(IRInfo info, String fieldModule, String fieldName, List args) throws org.overture.codegen.cgast.analysis.AnalysisException { - AClassDeclCG classDecl = assistantManager.getDeclAssistant().findClass(info.getClasses(), fieldModule); + ADefaultClassDeclCG classDecl = assistantManager.getDeclAssistant().findClass(info.getClasses(), fieldModule); List methods = assistantManager.getDeclAssistant().getAllMethods(classDecl, info.getClasses()); @@ -193,8 +193,8 @@ public AMethodTypeCG getMethodType(IRInfo info, return null; } - public STypeCG getFieldType(AClassDeclCG classDecl, String fieldName, - List classes) + public STypeCG getFieldType(ADefaultClassDeclCG classDecl, String fieldName, + List classes) { for (AFieldDeclCG field : assistantManager.getDeclAssistant().getAllFields(classDecl, classes)) { @@ -207,7 +207,7 @@ public STypeCG getFieldType(AClassDeclCG classDecl, String fieldName, return null; } - public STypeCG getFieldType(List classes, + public STypeCG getFieldType(List classes, ARecordTypeCG recordType, String memberName) { AFieldDeclCG field = assistantManager.getDeclAssistant().getFieldDecl(classes, recordType, memberName); @@ -231,10 +231,10 @@ public List getFieldTypes(ARecordDeclCG record) return fieldTypes; } - public STypeCG getFieldType(List classes, String moduleName, + public STypeCG getFieldType(List classes, String moduleName, String fieldName) { - AClassDeclCG classDecl = assistantManager.getDeclAssistant().findClass(classes, moduleName); + ADefaultClassDeclCG classDecl = assistantManager.getDeclAssistant().findClass(classes, moduleName); return getFieldType(classDecl, fieldName, classes); } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRAnalysis.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRAnalysis.java index 3821502bfd..2720b4d2c3 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRAnalysis.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRAnalysis.java @@ -25,21 +25,21 @@ import org.overture.codegen.analysis.vdm.QuoteAnalysis; import org.overture.codegen.analysis.vdm.UtilAnalysis; import org.overture.codegen.cgast.analysis.AnalysisException; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; public class IRAnalysis { - public static boolean usesQuoteLiterals(AClassDeclCG classDecl) + public static boolean usesQuoteLiterals(ADefaultClassDeclCG classDecl) { return hasDependency(classDecl, new QuoteAnalysis()); } - public static boolean usesUtils(AClassDeclCG classDecl) + public static boolean usesUtils(ADefaultClassDeclCG classDecl) { return hasDependency(classDecl, new UtilAnalysis()); } - private static boolean hasDependency(AClassDeclCG classDecl, + private static boolean hasDependency(ADefaultClassDeclCG classDecl, AbstractAnalysis analysis) { try diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java index a1b4e89be1..d047fcbc79 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java @@ -36,7 +36,7 @@ import org.overture.codegen.analysis.vdm.IdStateDesignatorDefCollector; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.SExpCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; import org.overture.codegen.trans.ITotalTransformation; @@ -85,7 +85,7 @@ public IRStatus generateFrom(org.overture.ast.node.INode node) if(node instanceof SClassDefinition) { - AClassDeclCG classCg = node.apply(codeGenInfo.getClassVisitor(), codeGenInfo); + ADefaultClassDeclCG classCg = node.apply(codeGenInfo.getClassVisitor(), codeGenInfo); Set unsupportedNodes = new HashSet(codeGenInfo.getUnsupportedNodes()); String name = ((SClassDefinition) node).getName().getName(); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java index c4ed4a076c..82f4ff5c2c 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java @@ -58,7 +58,7 @@ import org.overture.codegen.cgast.STraceCoreDeclCG; import org.overture.codegen.cgast.STraceDeclCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; import org.overture.codegen.logging.Logger; import org.overture.codegen.visitor.CGVisitor; @@ -101,7 +101,7 @@ public class IRInfo private Map idStateDesignatorDefs; // IR classes - private List classes; + private List classes; // IR modules private List modules; @@ -124,7 +124,7 @@ public IRInfo(String objectInitCallPrefix) this.objectInitCallNames = new HashMap(); this.idStateDesignatorDefs = new HashMap(); - this.classes = new LinkedList(); + this.classes = new LinkedList(); this.modules = new LinkedList(); } @@ -133,7 +133,7 @@ public AssistantManager getAssistantManager() return assistantManager; } - public CGVisitor getClassVisitor() + public CGVisitor getClassVisitor() { return visitorManager.getClassVisitor(); } @@ -383,12 +383,12 @@ public void setIdStateDesignatorDefs(Map getClasses() + public List getClasses() { return classes; } - public void addClass(AClassDeclCG irClass) + public void addClass(ADefaultClassDeclCG irClass) { if(this.classes != null) { @@ -398,9 +398,9 @@ public void addClass(AClassDeclCG irClass) public void removeClass(String name) { - AClassDeclCG classToRemove = null; + ADefaultClassDeclCG classToRemove = null; - for (AClassDeclCG clazz : classes) + for (ADefaultClassDeclCG clazz : classes) { if(clazz.getName().equals(name)) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/merging/TemplateManager.java b/core/codegen/platform/src/main/java/org/overture/codegen/merging/TemplateManager.java index 838fd0450f..b8030b10a9 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/merging/TemplateManager.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/merging/TemplateManager.java @@ -32,7 +32,7 @@ import org.apache.velocity.runtime.parser.node.SimpleNode; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.declarations.ACatchClauseDeclCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AInterfaceDeclCG; @@ -168,7 +168,7 @@ protected void initNodeTemplateFileNames() nodeTemplateFileNames = new HashMap, String>(); // Declarations - nodeTemplateFileNames.put(AClassDeclCG.class, templateStructure.DECL_PATH + nodeTemplateFileNames.put(ADefaultClassDeclCG.class, templateStructure.DECL_PATH + "Class"); nodeTemplateFileNames.put(ARecordDeclCG.class, templateStructure.DECL_PATH diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceStmsBuilder.java b/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceStmsBuilder.java index d127007549..ea93f2ff3e 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceStmsBuilder.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceStmsBuilder.java @@ -16,7 +16,7 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.AnswerAdaptor; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; @@ -65,7 +65,7 @@ public class TraceStmsBuilder extends AnswerAdaptor { private IRInfo info; - private List classes; + private List classes; private TransAssistantCG transAssistant; private IterationVarPrefixes iteVarPrefixes; private ILanguageIterator langIterator; @@ -78,7 +78,7 @@ public class TraceStmsBuilder extends AnswerAdaptor private Map idConstNameMap; - public TraceStmsBuilder(IRInfo info, List classes, + public TraceStmsBuilder(IRInfo info, List classes, TransAssistantCG transAssistant, IterationVarPrefixes iteVarPrefixes, TraceNames tracePrefixes, ILanguageIterator langIterator, ICallStmToStringMethodBuilder toStringBuilder, diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/traces/TracesTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/traces/TracesTrans.java index 830f9e6f4f..e5d9e1541f 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/traces/TracesTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/traces/TracesTrans.java @@ -3,7 +3,7 @@ import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.ANamedTraceDeclCG; @@ -58,7 +58,7 @@ public void caseANamedTraceDeclCG(ANamedTraceDeclCG node) return; } - AClassDeclCG enclosingClass = node.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); if (enclosingClass != null) { @@ -163,7 +163,7 @@ private String getTraceEnclosingClass(ANamedTraceDeclCG trace) { if (trace != null) { - AClassDeclCG enclosingClass = trace.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = trace.getAncestor(ADefaultClassDeclCG.class); if (enclosingClass != null) { return enclosingClass.getName(); @@ -190,7 +190,7 @@ private String getTraceName(ANamedTraceDeclCG node) private String getClassName(ANamedTraceDeclCG node) { - AClassDeclCG enclosingClass = node.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); String traceClassName = ""; if (enclosingClass != null) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/ModuleToClassTransformation.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/ModuleToClassTransformation.java index 7aa3411131..7bbd3c5de3 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/ModuleToClassTransformation.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/ModuleToClassTransformation.java @@ -10,7 +10,7 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; import org.overture.codegen.cgast.declarations.AAllImportCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFromModuleImportsCG; import org.overture.codegen.cgast.declarations.AFuncDeclCG; @@ -38,7 +38,7 @@ public class ModuleToClassTransformation extends DepthFirstAnalysisAdaptor implements ITotalTransformation { - private AClassDeclCG clazz = null; + private ADefaultClassDeclCG clazz = null; private IRInfo info; private TransAssistantCG transAssistant; @@ -54,7 +54,7 @@ public ModuleToClassTransformation(IRInfo info, TransAssistantCG transAssistant, @Override public void caseAModuleDeclCG(AModuleDeclCG node) throws AnalysisException { - clazz = new AClassDeclCG(); + clazz = new ADefaultClassDeclCG(); clazz.setSourceNode(node.getSourceNode()); clazz.setAccess(IRConstants.PUBLIC); clazz.setName(node.getName()); @@ -159,7 +159,7 @@ public void caseAModuleDeclCG(AModuleDeclCG node) throws AnalysisException info.addClass(clazz); } - private void handleImports(final AModuleImportsCG moduleImports, final AClassDeclCG clazz) throws AnalysisException + private void handleImports(final AModuleImportsCG moduleImports, final ADefaultClassDeclCG clazz) throws AnalysisException { //name = moduleImports.getName(); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/PrePostTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/PrePostTrans.java index ce7a63b733..db76672a87 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/PrePostTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/PrePostTrans.java @@ -5,7 +5,7 @@ import org.overture.codegen.cgast.SDeclCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.ir.IRInfo; @@ -29,7 +29,7 @@ public void caseAMethodDeclCG(AMethodDeclCG node) return; } - AClassDeclCG enclosingClass = node.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); if(enclosingClass == null) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/EvalPermPredTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/EvalPermPredTrans.java index 3473a757c9..c235447e11 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/EvalPermPredTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/EvalPermPredTrans.java @@ -4,7 +4,7 @@ import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; import org.overture.codegen.cgast.expressions.SVarExpCG; @@ -129,7 +129,7 @@ private void handleStateUpdate(SStmCG node) private STypeCG getSentinelFieldType(SStmCG node) { - AClassDeclCG enclosingClass = node.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); STypeCG fieldType = null; diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MainClassConcTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MainClassConcTrans.java index f7b7aee262..74c7448656 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MainClassConcTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MainClassConcTrans.java @@ -7,7 +7,7 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AInterfaceDeclCG; @@ -55,7 +55,7 @@ public MainClassConcTrans(IRInfo info) @SuppressWarnings("unchecked") @Override - public void caseAClassDeclCG(AClassDeclCG node) throws AnalysisException + public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisException { if(!info.getSettings().generateConc()) { @@ -297,13 +297,13 @@ private boolean isIRGenerated(AMethodDeclCG method) return method.getTag() instanceof IRGeneratedTag; } - private void makeThread(AClassDeclCG node) + private void makeThread(ADefaultClassDeclCG node) { - AClassDeclCG threadClass = getThreadClass(node.getSuperName(), node); + ADefaultClassDeclCG threadClass = getThreadClass(node.getSuperName(), node); threadClass.setSuperName("VDMThread"); } - private AClassDeclCG getThreadClass(String superName, AClassDeclCG classCg) + private ADefaultClassDeclCG getThreadClass(String superName, ADefaultClassDeclCG classCg) { if(superName == null || superName.equals("VDMThread")) { @@ -311,9 +311,9 @@ private AClassDeclCG getThreadClass(String superName, AClassDeclCG classCg) } else { - AClassDeclCG superClass = null; + ADefaultClassDeclCG superClass = null; - for(AClassDeclCG c : info.getClasses()) + for(ADefaultClassDeclCG c : info.getClasses()) { if(c.getName().equals(superName)) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MutexDeclTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MutexDeclTrans.java index cfb4adde2c..cff6bff78e 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MutexDeclTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MutexDeclTrans.java @@ -3,7 +3,7 @@ import org.overture.codegen.cgast.SNameCG; import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AMutexSyncDeclCG; import org.overture.codegen.cgast.declarations.APersyncDeclCG; import org.overture.codegen.cgast.expressions.AAndBoolBinaryExpCG; @@ -27,7 +27,7 @@ public MutexDeclTrans(IRInfo info) } @Override - public void caseAClassDeclCG(AClassDeclCG node) throws AnalysisException + public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisException { String hop = "active"; if(!info.getSettings().generateConc()) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/SentinelTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/SentinelTrans.java index 0e0325f0ad..d17bdb7578 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/SentinelTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/SentinelTrans.java @@ -4,7 +4,7 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; @@ -38,14 +38,14 @@ public SentinelTrans(IRInfo info) @SuppressWarnings("unchecked") @Override - public void caseAClassDeclCG(AClassDeclCG node) throws AnalysisException + public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisException { if(!info.getSettings().generateConc()) { return; } - AClassDeclCG innerClass = new AClassDeclCG(); + ADefaultClassDeclCG innerClass = new ADefaultClassDeclCG(); innerClass.setStatic(true); String classname = node.getName(); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conv/ObjectDesignatorToExpCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conv/ObjectDesignatorToExpCG.java index f720b85446..a6f6ebda65 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conv/ObjectDesignatorToExpCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conv/ObjectDesignatorToExpCG.java @@ -30,7 +30,7 @@ import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.AnswerAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; import org.overture.codegen.cgast.expressions.AFieldExpCG; import org.overture.codegen.cgast.expressions.ASelfExpCG; @@ -143,7 +143,7 @@ public SExpCG caseANewObjectDesignatorCG(ANewObjectDesignatorCG node) public SExpCG caseASelfObjectDesignatorCG(ASelfObjectDesignatorCG node) throws AnalysisException { - AClassDeclCG enclosingClass = node.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); String className = enclosingClass.getName(); SourceNode sourceNode = node.getSourceNode(); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/letexps/FuncTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/letexps/FuncTrans.java index 840b121885..3474fc5128 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/letexps/FuncTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/letexps/FuncTrans.java @@ -24,7 +24,7 @@ import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFuncDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.trans.assistants.TransAssistantCG; @@ -45,9 +45,9 @@ public void caseAFuncDeclCG(AFuncDeclCG node) throws AnalysisException INode parent = node.parent(); - if(parent instanceof AClassDeclCG) + if(parent instanceof ADefaultClassDeclCG) { - AClassDeclCG enclosingClass = (AClassDeclCG) parent; + ADefaultClassDeclCG enclosingClass = (ADefaultClassDeclCG) parent; if(enclosingClass.getInvariant() == node) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java index 1ddf18acdc..17583074a2 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java @@ -34,7 +34,7 @@ import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; @@ -612,7 +612,7 @@ public void inANewExpCG(ANewExpCG node) throws AnalysisException if (type instanceof AClassTypeCG) { - for (AClassDeclCG classCg : transAssistant.getInfo().getClasses()) + for (ADefaultClassDeclCG classCg : transAssistant.getInfo().getClasses()) { for (AMethodDeclCG method : classCg.getMethods()) { @@ -633,7 +633,7 @@ public void inANewExpCG(ANewExpCG node) throws AnalysisException String definingClassName = recordType.getName().getDefiningClass(); String recordName = recordType.getName().getName(); - AClassDeclCG classDecl = transAssistant.getInfo().getAssistantManager().getDeclAssistant().findClass(transAssistant.getInfo().getClasses(), definingClassName); + ADefaultClassDeclCG classDecl = transAssistant.getInfo().getAssistantManager().getDeclAssistant().findClass(transAssistant.getInfo().getClasses(), definingClassName); ARecordDeclCG record = transAssistant.getInfo().getAssistantManager().getDeclAssistant().findRecord(classDecl, recordName); List fieldTypes = transAssistant.getInfo().getAssistantManager().getTypeAssistant().getFieldTypes(record); @@ -666,7 +666,7 @@ public void caseAPlainCallStmCG(APlainCallStmCG node) throws AnalysisException STypeCG classType = node.getClassType(); String className = classType instanceof AClassTypeCG ? ((AClassTypeCG) classType).getName() - : node.getAncestor(AClassDeclCG.class).getName(); + : node.getAncestor(ADefaultClassDeclCG.class).getName(); handleCallStm(node, className); } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ClassVisitorCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ClassVisitorCG.java index 4572c1ba56..31ee663b3b 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ClassVisitorCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ClassVisitorCG.java @@ -30,7 +30,7 @@ import org.overture.ast.intf.lex.ILexNameToken; import org.overture.codegen.cgast.SDeclCG; import org.overture.codegen.cgast.SPatternCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AFuncDeclCG; @@ -48,14 +48,14 @@ import org.overture.codegen.ir.IRInfo; import org.overture.codegen.logging.Logger; -public class ClassVisitorCG extends AbstractVisitorCG +public class ClassVisitorCG extends AbstractVisitorCG { public ClassVisitorCG() { } - + @Override - public AClassDeclCG caseAClassClassDefinition(AClassClassDefinition node, + public ADefaultClassDeclCG caseAClassClassDefinition(AClassClassDefinition node, IRInfo question) throws AnalysisException { String name = node.getName().getName(); @@ -64,7 +64,7 @@ public AClassDeclCG caseAClassClassDefinition(AClassClassDefinition node, boolean isStatic = false; LinkedList superNames = node.getSupernames(); - AClassDeclCG classCg = new AClassDeclCG(); + ADefaultClassDeclCG classCg = new ADefaultClassDeclCG(); classCg.setPackage(null); classCg.setName(name); classCg.setAccess(access); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/VisitorManager.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/VisitorManager.java index 7801fe90ad..be9a11009d 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/VisitorManager.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/VisitorManager.java @@ -38,7 +38,7 @@ import org.overture.codegen.cgast.STraceCoreDeclCG; import org.overture.codegen.cgast.STraceDeclCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; import org.overture.codegen.traces.TermVisitorCG; import org.overture.codegen.traces.TraceCoreDeclVisitorCG; @@ -46,7 +46,7 @@ public class VisitorManager { - private CGVisitor classVisitor; + private CGVisitor classVisitor; private CGVisitor moduleVisitor; private CGVisitor importsVisitor; private CGVisitor importVisitor; @@ -68,7 +68,7 @@ public class VisitorManager public VisitorManager() { - this.classVisitor = new CGVisitor(new ClassVisitorCG()); + this.classVisitor = new CGVisitor(new ClassVisitorCG()); this.moduleVisitor = new CGVisitor(new ModuleVisitorCG()); this.importsVisitor = new CGVisitor(new ImportsVisitorCG()); this.importVisitor = new CGVisitor(new ImportVisitorCG()); @@ -89,7 +89,7 @@ public VisitorManager() this.traceCoreDeclVisitor = new CGVisitor(new TraceCoreDeclVisitorCG()); } - public CGVisitor getClassVisitor() + public CGVisitor getClassVisitor() { return classVisitor; } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java index f5a2dfe587..f6c166d93b 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java @@ -6,7 +6,7 @@ import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.analysis.AnalysisException; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; @@ -171,7 +171,7 @@ public void caseAReturnStmCG(AReturnStmCG node) throws AnalysisException } @Override - public void caseAClassDeclCG(AClassDeclCG node) throws AnalysisException + public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisException { namedTypeHandler.handleClass(node); } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlAnnotationHelper.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlAnnotationHelper.java index 75e15e88e2..af67595b7c 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlAnnotationHelper.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlAnnotationHelper.java @@ -7,7 +7,7 @@ import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.PCG; import org.overture.codegen.cgast.SDeclCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; @@ -25,7 +25,7 @@ public JmlAnnotationHelper(JmlGenerator jmlGen) this.jmlGen = jmlGen; } - public void makeNamedTypeInvFuncsPublic(AClassDeclCG clazz) + public void makeNamedTypeInvFuncsPublic(ADefaultClassDeclCG clazz) { List nameInvMethods = jmlGen.getUtil().getNamedTypeInvMethods(clazz); @@ -76,14 +76,14 @@ private void appendFieldNames(List fieldNames, StringBuilder sb) { sb.append(");"); } - public void addInvCheckGhostVarDecl(AClassDeclCG owner) + public void addInvCheckGhostVarDecl(ADefaultClassDeclCG owner) { String metaStr = String.format(JmlGenerator.JML_INV_CHECKS_ON_DECL, JmlGenerator.INV_CHECKS_ON_GHOST_VAR_NAME); appendMetaData(owner, consMetaData(metaStr)); } - public String consInvChecksOnName(AClassDeclCG owner) + public String consInvChecksOnName(ADefaultClassDeclCG owner) { StringBuilder prefix = new StringBuilder(); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java index e111aa7426..2ac57388a8 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java @@ -9,7 +9,7 @@ import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.SPatternCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AInterfaceDeclCG; @@ -121,7 +121,7 @@ public AMethodDeclCG getInvMethod(ATypeDeclCG typeDecl) return null; } - public List getNamedTypeInvMethods(AClassDeclCG clazz) + public List getNamedTypeInvMethods(ADefaultClassDeclCG clazz) { List invDecls = new LinkedList(); @@ -156,7 +156,7 @@ public List getRecords(List> ast) { List records = new LinkedList(); - for (IRStatus classStatus : IRStatus.extract(ast, AClassDeclCG.class)) + for (IRStatus classStatus : IRStatus.extract(ast, ADefaultClassDeclCG.class)) { for (ATypeDeclCG typeDecl : classStatus.getIrNode().getTypeDecls()) { @@ -224,9 +224,9 @@ public List> makeRecsOuterClasses(List> ast, Rec { List> extraClasses = new LinkedList>(); - for (IRStatus status : IRStatus.extract(ast, AClassDeclCG.class)) + for (IRStatus status : IRStatus.extract(ast, ADefaultClassDeclCG.class)) { - AClassDeclCG clazz = status.getIrNode(); + ADefaultClassDeclCG clazz = status.getIrNode(); List recDecls = new LinkedList(); @@ -243,7 +243,7 @@ public List> makeRecsOuterClasses(List> ast, Rec // For each of the records we will make a top-level class for (ARecordDeclCG recDecl : recDecls) { - AClassDeclCG recClass = new AClassDeclCG(); + ADefaultClassDeclCG recClass = new ADefaultClassDeclCG(); recClass.setMetaData(recDecl.getMetaData()); recClass.setAbstract(false); @@ -327,7 +327,7 @@ public String consRecPackage(String defClass) return recPackage; } - public AMethodDeclCG genInvMethod(AClassDeclCG clazz, + public AMethodDeclCG genInvMethod(ADefaultClassDeclCG clazz, ANamedTypeDeclCG namedTypeDecl) { AReturnStmCG body = new AReturnStmCG(); @@ -360,7 +360,7 @@ public AMethodDeclCG genInvMethod(AClassDeclCG clazz, return method; } - public AIfStmCG consDynamicTypeCheck(IRStatus status, AMethodDeclCG method, + public AIfStmCG consDynamicTypeCheck(IRStatus status, AMethodDeclCG method, ANamedTypeDeclCG namedTypeDecl) { AIdentifierVarExpCG paramExp = getInvParamVar(method); @@ -531,7 +531,7 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMethodDeclC return dynTypeCheck; } - public AIdentifierPatternCG consInvParamReplacementId(AClassDeclCG encClass, String originalParamName) + public AIdentifierPatternCG consInvParamReplacementId(ADefaultClassDeclCG encClass, String originalParamName) { NameGen nameGen = new NameGen(encClass); nameGen.addName(originalParamName); @@ -542,9 +542,9 @@ public AIdentifierPatternCG consInvParamReplacementId(AClassDeclCG encClass, Str return jmlGen.getJavaGen().getInfo().getPatternAssistant().consIdPattern(newParamName); } - public AClassDeclCG getEnclosingClass(INode node) + public ADefaultClassDeclCG getEnclosingClass(INode node) { - AClassDeclCG enclosingClass = node.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); if (enclosingClass != null) { @@ -590,9 +590,9 @@ public void distributeNamedTypeInvs(List> newAst) { // Collect all named type invariants List allNamedTypeInvTypeDecls = new LinkedList(); - for(IRStatus status : IRStatus.extract(newAst, AClassDeclCG.class)) + for(IRStatus status : IRStatus.extract(newAst, ADefaultClassDeclCG.class)) { - AClassDeclCG clazz = status.getIrNode(); + ADefaultClassDeclCG clazz = status.getIrNode(); if(jmlGen.getJavaGen().getInfo().getDeclAssistant().isLibraryName(clazz.getName())) { @@ -608,9 +608,9 @@ public void distributeNamedTypeInvs(List> newAst) } } - for(IRStatus status : IRStatus.extract(newAst, AClassDeclCG.class)) + for(IRStatus status : IRStatus.extract(newAst, ADefaultClassDeclCG.class)) { - AClassDeclCG clazz = status.getIrNode(); + ADefaultClassDeclCG clazz = status.getIrNode(); if(jmlGen.getJavaGen().getInfo().getDeclAssistant().isLibraryName(clazz.getName())) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java index c34851c042..9b7fa153a1 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java @@ -11,7 +11,7 @@ import org.overture.codegen.cgast.SDeclCG; import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; @@ -79,7 +79,7 @@ public class JmlGenerator implements IREventObserver private StateDesInfo stateDesInfo; // The class owning the invChecksOn flag - private AClassDeclCG invChecksFlagOwner = null; + private ADefaultClassDeclCG invChecksFlagOwner = null; public JmlGenerator() { @@ -194,7 +194,7 @@ public List> finalIRConstructed(List> ast, newAst.addAll(util.makeRecsOuterClasses(ast, recInfo)); // Also extract classes that are records - for(IRStatus status : IRStatus.extract(newAst, AClassDeclCG.class)) + for(IRStatus status : IRStatus.extract(newAst, ADefaultClassDeclCG.class)) { // VDM uses the type system to control whether 'nil' is allowed as a value so we'll // just annotate all classes as @nullable_by_default @@ -202,9 +202,9 @@ public List> finalIRConstructed(List> ast, } // Only extract from 'ast' to not get the record classes - for (IRStatus status : IRStatus.extract(ast, AClassDeclCG.class)) + for (IRStatus status : IRStatus.extract(ast, ADefaultClassDeclCG.class)) { - AClassDeclCG clazz = status.getIrNode(); + ADefaultClassDeclCG clazz = status.getIrNode(); if(info.getDeclAssistant().isLibraryName(clazz.getName())) { @@ -301,7 +301,7 @@ private void sortAnnotations(List> newAst) { AnnotationSorter sorter = new AnnotationSorter(); - for (IRStatus status : IRStatus.extract(newAst, AClassDeclCG.class)) + for (IRStatus status : IRStatus.extract(newAst, ADefaultClassDeclCG.class)) { if (!javaGen.getInfo().getDeclAssistant().isLibraryName(status.getIrNode().getName())) { @@ -339,9 +339,9 @@ private void addAssertions(List> newAst, StateDesInfo stateDesIn { InvAssertionTrans assertTr = new InvAssertionTrans(this, stateDesInfo, recInfo); - for (IRStatus status : IRStatus.extract(newAst, AClassDeclCG.class)) + for (IRStatus status : IRStatus.extract(newAst, ADefaultClassDeclCG.class)) { - AClassDeclCG clazz = status.getIrNode(); + ADefaultClassDeclCG clazz = status.getIrNode(); if (!this.javaGen.getInfo().getDeclAssistant().isLibraryName(clazz.getName())) { @@ -389,7 +389,7 @@ private void annotateRecsWithInvs(List> ast) private void setInvChecksOnOwner(List> ast) { - for (IRStatus status : IRStatus.extract(ast, AClassDeclCG.class)) + for (IRStatus status : IRStatus.extract(ast, ADefaultClassDeclCG.class)) { if(invChecksFlagOwner == null) { @@ -456,9 +456,9 @@ private List consMethodCond(SDeclCG decl, return null; } - public void adjustNamedTypeInvFuncs(IRStatus status) + public void adjustNamedTypeInvFuncs(IRStatus status) { - AClassDeclCG clazz = status.getIrNode(); + ADefaultClassDeclCG clazz = status.getIrNode(); for (ATypeDeclCG typeDecl : clazz.getTypeDecls()) { @@ -603,7 +603,7 @@ public List getTypeInfoList() return typeInfoList; } - public AClassDeclCG getInvChecksFlagOwner() + public ADefaultClassDeclCG getInvChecksFlagOwner() { return invChecksFlagOwner; } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NameGen.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NameGen.java index c8ce3b3ca5..28ea2ed417 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NameGen.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NameGen.java @@ -3,7 +3,7 @@ import java.util.HashSet; import java.util.Set; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; /** @@ -15,7 +15,7 @@ public class NameGen { private Set toAvoid; - public NameGen(AClassDeclCG classDecl) + public NameGen(ADefaultClassDeclCG classDecl) { this.toAvoid = new HashSet(); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java index cd183ee275..1dc8208c5a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java @@ -7,7 +7,7 @@ import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; @@ -39,7 +39,7 @@ public NamedTypeInvHandler(InvAssertionTrans invTrans) this.util = new NamedTypeInvUtil(this); } - public void handleClass(AClassDeclCG node) throws AnalysisException + public void handleClass(ADefaultClassDeclCG node) throws AnalysisException { // We want only to treat fields and methods specified by the user. // This case helps us avoiding visiting invariant methods @@ -68,7 +68,7 @@ public void handleField(AFieldDeclCG node) return; } - AClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) { @@ -177,7 +177,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException if (!invTypes.isEmpty()) { - AClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) { @@ -220,7 +220,7 @@ public AMetaStmCG handleMapSeq(AMapSeqUpdateStmCG node) if (!invTypes.isEmpty()) { - AClassDeclCG enclosingClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG enclosingClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); if (enclosingClass == null) { @@ -264,7 +264,7 @@ public AMetaStmCG handleVarDecl(AVarDeclCG node) return null; } - AClassDeclCG enclosingClass = node.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); if (enclosingClass == null) { @@ -295,7 +295,7 @@ public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) if (!invTypes.isEmpty()) { - AClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) { @@ -351,7 +351,7 @@ public void handleAssign(AAssignToExpStmCG node) return; } - AClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) { @@ -431,7 +431,7 @@ public AMetaStmCG consAssert(AIdentifierVarExpCG var) return null; } - AClassDeclCG encClass = invTrans.getStateDesInfo().getEnclosingClass(var); + ADefaultClassDeclCG encClass = invTrans.getStateDesInfo().getEnclosingClass(var); if (encClass == null) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecInvTransformation.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecInvTransformation.java index b48a09aa4b..6e0bd3673c 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecInvTransformation.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecInvTransformation.java @@ -7,7 +7,7 @@ import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; @@ -150,7 +150,7 @@ public void caseAIdentifierVarExpCG(AIdentifierVarExpCG node) if (varExp.getVardef() instanceof SFunctionDefinition || varExp.getVardef() instanceof SOperationDefinition) { - AClassDeclCG encClass = rec.getAncestor(AClassDeclCG.class); + ADefaultClassDeclCG encClass = rec.getAncestor(ADefaultClassDeclCG.class); if (encClass != null) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/StateDesInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/StateDesInfo.java index da111dd36f..7665171828 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/StateDesInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/StateDesInfo.java @@ -5,7 +5,7 @@ import java.util.Map; import org.overture.codegen.cgast.SStmCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; @@ -74,7 +74,7 @@ public List getStateDesVars(SStmCG stm) return stateDesVars.get(stm); } - public AClassDeclCG getEnclosingClass(AIdentifierVarExpCG stateDesVar) + public ADefaultClassDeclCG getEnclosingClass(AIdentifierVarExpCG stateDesVar) { for(SStmCG k : stateDesVars.keySet()) { @@ -82,7 +82,7 @@ public AClassDeclCG getEnclosingClass(AIdentifierVarExpCG stateDesVar) { if(v == stateDesVar) { - return k.getAncestor(AClassDeclCG.class); + return k.getAncestor(ADefaultClassDeclCG.class); } } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/AnnotationSorter.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/AnnotationSorter.java index 93b210f13f..22bddddc01 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/AnnotationSorter.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/AnnotationSorter.java @@ -7,7 +7,7 @@ import org.overture.codegen.cgast.PCG; import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; public class AnnotationSorter extends DepthFirstAnalysisAdaptor { @@ -27,9 +27,9 @@ public void defaultInPCG(PCG node) throws AnalysisException Collections.sort(node.getMetaData(), comparator); } - if(node instanceof AClassDeclCG) + if(node instanceof ADefaultClassDeclCG) { - AClassDeclCG clazz = (AClassDeclCG) node; + ADefaultClassDeclCG clazz = (ADefaultClassDeclCG) node; if(!clazz.getGlobalMetaData().isEmpty()) { diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/AnnotationTestsBase.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/AnnotationTestsBase.java index 24979cf933..6c22659378 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/AnnotationTestsBase.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/AnnotationTestsBase.java @@ -13,7 +13,7 @@ import org.overture.ast.modules.AModuleModules; import org.overture.ast.util.ClonableString; import org.overture.codegen.cgast.PCG; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.ir.IRSettings; import org.overture.codegen.logging.Logger; @@ -46,10 +46,10 @@ abstract public class AnnotationTestsBase private static final boolean VERBOSE = false; // The IR class that the input module generates to - protected static AClassDeclCG genModule; + protected static ADefaultClassDeclCG genModule; // The IR class that is used to represent the type of the module state - protected static AClassDeclCG genStateType; + protected static ADefaultClassDeclCG genStateType; @BeforeClass public static void prepareVdmTypeChecker() @@ -60,9 +60,9 @@ public static void prepareVdmTypeChecker() public static void init(String fileName) throws AnalysisException { - List classes = getClasses(fileName); + List classes = getClasses(fileName); - for (AClassDeclCG clazz : classes) + for (ADefaultClassDeclCG clazz : classes) { if (clazz.getName().equals(MODULE_NAME)) { @@ -105,9 +105,9 @@ public static void initJmlGen(JmlGenerator jmlGen) javaSettings.setGenRecsAsInnerClasses(false); } - public static List getClasses(GeneratedData data) + public static List getClasses(GeneratedData data) { - List classes = new LinkedList(); + List classes = new LinkedList(); for (GeneratedModule node : data.getClasses()) { @@ -117,9 +117,9 @@ public static List getClasses(GeneratedData data) Logger.getLog().println("*******************"); } - if (node.getIrNode() instanceof AClassDeclCG) + if (node.getIrNode() instanceof ADefaultClassDeclCG) { - classes.add((AClassDeclCG) node.getIrNode()); + classes.add((ADefaultClassDeclCG) node.getIrNode()); } } @@ -171,7 +171,7 @@ public static List getGenMethods(List methods) return genOps; } - public static List getClasses(String fileName) + public static List getClasses(String fileName) throws AnalysisException { List files = new LinkedList(); diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/NameGenTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/NameGenTests.java index 98b5352d8e..39a4f63a80 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/NameGenTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/NameGenTests.java @@ -3,7 +3,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.vdm2jml.NameGen; @@ -16,7 +16,7 @@ public class NameGenTests @Before public void init() { - AClassDeclCG testClass = new AClassDeclCG(); + ADefaultClassDeclCG testClass = new ADefaultClassDeclCG(); AFieldDeclCG field = new AFieldDeclCG(); field.setName("field"); diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/RecInvTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/RecInvTests.java index 782c5a11ca..ccd0784036 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/RecInvTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/RecInvTests.java @@ -6,21 +6,21 @@ import org.junit.BeforeClass; import org.junit.Test; import org.overture.ast.analysis.AnalysisException; -import org.overture.codegen.cgast.declarations.AClassDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; public class RecInvTests extends AnnotationTestsBase { private static final String REC_NAME = "Rec"; - private static AClassDeclCG recTypeDef; + private static ADefaultClassDeclCG recTypeDef; @BeforeClass public static void init() throws AnalysisException { - List classes = AnnotationTestsBase.getClasses("RecInv.vdmsl"); + List classes = AnnotationTestsBase.getClasses("RecInv.vdmsl"); - for (AClassDeclCG clazz : classes) + for (ADefaultClassDeclCG clazz : classes) { if (clazz.getName().equals(REC_NAME)) { From a912fb0d40730cd55227f57434a48813f4d22c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 22 Sep 2015 17:37:11 +0200 Subject: [PATCH 053/706] Introduce 'BUS', 'CPU' and 'System' classes in the IR --- core/codegen/ir/src/main/resources/cg.astv2 | 5 +- .../codegen/assistant/DeclAssistantCG.java | 190 ++++++++++++++++-- .../codegen/visitor/ClassVisitorCG.java | 188 +++-------------- 3 files changed, 203 insertions(+), 180 deletions(-) diff --git a/core/codegen/ir/src/main/resources/cg.astv2 b/core/codegen/ir/src/main/resources/cg.astv2 index 0895e1488a..fc1515861d 100644 --- a/core/codegen/ir/src/main/resources/cg.astv2 +++ b/core/codegen/ir/src/main/resources/cg.astv2 @@ -238,7 +238,10 @@ CG {-> package='org.overture.codegen.cgast' | [typeDecls]:CG.#decl.type* | [perSyncs]:CG.#decl.persync* | [mutexSyncs]:CG.#decl.mutexSync*} - = {default} + = {bus} + | {cpu} + | {system} + | {default} ; #stateDesignator {-> package='org.overture.codegen.cgast.statements' diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java index a1fd2a42eb..513b329851 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java @@ -31,6 +31,7 @@ import org.overture.ast.definitions.AClassClassDefinition; import org.overture.ast.definitions.AEqualsDefinition; import org.overture.ast.definitions.AExplicitFunctionDefinition; +import org.overture.ast.definitions.AExplicitOperationDefinition; import org.overture.ast.definitions.AImplicitOperationDefinition; import org.overture.ast.definitions.AValueDefinition; import org.overture.ast.definitions.PDefinition; @@ -50,18 +51,25 @@ import org.overture.codegen.cgast.SPatternCG; import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AFuncDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; +import org.overture.codegen.cgast.declarations.AMutexSyncDeclCG; +import org.overture.codegen.cgast.declarations.ANamedTraceDeclCG; +import org.overture.codegen.cgast.declarations.APersyncDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; +import org.overture.codegen.cgast.declarations.AThreadDeclCG; import org.overture.codegen.cgast.declarations.ATypeDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; +import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; import org.overture.codegen.cgast.expressions.ANotImplementedExpCG; import org.overture.codegen.cgast.name.ATypeNameCG; +import org.overture.codegen.cgast.patterns.AIdentifierPatternCG; import org.overture.codegen.cgast.statements.ABlockStmCG; import org.overture.codegen.cgast.statements.ANotImplementedStmCG; +import org.overture.codegen.cgast.statements.APlainCallStmCG; import org.overture.codegen.cgast.statements.AReturnStmCG; import org.overture.codegen.cgast.types.ABoolBasicTypeCG; import org.overture.codegen.cgast.types.ACharBasicTypeCG; @@ -74,7 +82,9 @@ import org.overture.codegen.cgast.types.ARecordTypeCG; import org.overture.codegen.cgast.types.AStringTypeCG; import org.overture.codegen.cgast.types.ATemplateTypeCG; +import org.overture.codegen.cgast.types.AVoidTypeCG; import org.overture.codegen.ir.IRConstants; +import org.overture.codegen.ir.IRGeneratedTag; import org.overture.codegen.ir.IRInfo; import org.overture.codegen.ir.SourceNode; import org.overture.codegen.logging.Logger; @@ -87,6 +97,144 @@ public DeclAssistantCG(AssistantManager assistantManager) super(assistantManager); } + public T buildClass(SClassDefinition node, IRInfo question, T classCg) throws AnalysisException + { + String name = node.getName().getName(); + String access = node.getAccess().getAccess().toString(); + boolean isAbstract = node.getIsAbstract(); + boolean isStatic = false; + LinkedList superNames = node.getSupernames(); + + classCg.setPackage(null); + classCg.setName(name); + classCg.setAccess(access); + classCg.setAbstract(isAbstract); + classCg.setStatic(isStatic); + classCg.setStatic(false); + + if (superNames.size() >= 1) + { + classCg.setSuperName(superNames.get(0).getName()); + } + + LinkedList defs = node.getDefinitions(); + + for (PDefinition def : defs) + { + SDeclCG decl = def.apply(question.getDeclVisitor(), question); + + if (decl == null) + { + continue;// Unspported stuff returns null by default + } + if (decl instanceof AFieldDeclCG) + { + classCg.getFields().add((AFieldDeclCG) decl); + } else if (decl instanceof AMethodDeclCG) + { + + AMethodDeclCG method = (AMethodDeclCG) decl; + + if (method.getIsConstructor()) + { + String initName = question.getObjectInitializerCall((AExplicitOperationDefinition) def); + + AMethodDeclCG objInitializer = method.clone(); + objInitializer.setTag(new IRGeneratedTag(getClass().getName())); + objInitializer.setName(initName); + objInitializer.getMethodType().setResult(new AVoidTypeCG()); + objInitializer.setIsConstructor(false); + objInitializer.setPreCond(null); + objInitializer.setPostCond(null); + + classCg.getMethods().add(objInitializer); + + APlainCallStmCG initCall = new APlainCallStmCG(); + initCall.setType(objInitializer.getMethodType().getResult().clone()); + initCall.setClassType(null); + initCall.setName(initName); + + for (AFormalParamLocalParamCG param : method.getFormalParams()) + { + SPatternCG pattern = param.getPattern(); + + if (pattern instanceof AIdentifierPatternCG) + { + AIdentifierPatternCG idPattern = (AIdentifierPatternCG) pattern; + + AIdentifierVarExpCG var = new AIdentifierVarExpCG(); + var.setIsLocal(true); + var.setType(param.getType().clone()); + var.setName(idPattern.getName()); + var.setIsLambda(false); + var.setSourceNode(pattern.getSourceNode()); + + initCall.getArgs().add(var); + } + } + + method.setBody(initCall); + } + + classCg.getMethods().add(method); + } else if (decl instanceof ATypeDeclCG) + { + classCg.getTypeDecls().add((ATypeDeclCG) decl); + } else if (decl instanceof AFuncDeclCG) + { + classCg.getFunctions().add((AFuncDeclCG) decl); + } else if (decl instanceof AThreadDeclCG) + { + if (question.getSettings().generateConc()) + { + classCg.setThread((AThreadDeclCG) decl); + } + } + else if (decl instanceof APersyncDeclCG) + { + classCg.getPerSyncs().add((APersyncDeclCG) decl); + } + else if (decl instanceof AMutexSyncDeclCG) + { + classCg.getMutexSyncs().add((AMutexSyncDeclCG) decl); + } + else if(decl instanceof ANamedTraceDeclCG) + { + classCg.getTraces().add((ANamedTraceDeclCG) decl); + } + else + { + Logger.getLog().printErrorln("Unexpected definition in class: " + + name + ": " + def.getName().getName() + " at " + def.getLocation()); + } + } + + if(node.getInvariant() != null && question.getSettings().generateInvariants()) + { + SDeclCG invCg = node.getInvariant().apply(question.getDeclVisitor(), question); + classCg.setInvariant(invCg); + } + + boolean defaultConstructorExplicit = false; + for (AMethodDeclCG method : classCg.getMethods()) + { + if (method.getIsConstructor() && method.getFormalParams().isEmpty()) + { + defaultConstructorExplicit = true; + break; + } + } + + if (!defaultConstructorExplicit) + { + classCg.getMethods().add(question.getDeclAssistant().consDefaultContructor(name)); + } + + question.addClass(classCg); + + return classCg; + } + public AMethodDeclCG funcToMethod(AFuncDeclCG node) { SDeclCG preCond = node.getPreCond(); @@ -170,8 +318,8 @@ public boolean isLibraryName(String className) return false; } - public List getAllDecls(ADefaultClassDeclCG classDecl, - List classes, DeclStrategy strategy) + public List getAllDecls(SClassDeclCG classDecl, + List classes, DeclStrategy strategy) { List allDecls = new LinkedList(); @@ -181,7 +329,7 @@ public List getAllDecls(ADefaultClassDeclCG classDecl, while (superName != null) { - ADefaultClassDeclCG superClassDecl = findClass(classes, superName); + SClassDeclCG superClassDecl = findClass(classes, superName); if(superClassDecl == null) { @@ -204,8 +352,8 @@ public List getAllDecls(ADefaultClassDeclCG classDecl, return allDecls; } - public List getAllMethods(ADefaultClassDeclCG classDecl, - List classes) + public List getAllMethods(SClassDeclCG classDecl, + List classes) { DeclStrategy methodDeclStrategy = new DeclStrategy() { @@ -216,7 +364,7 @@ public String getAccess(AMethodDeclCG decl) } @Override - public List getDecls(ADefaultClassDeclCG classDecl) + public List getDecls(SClassDeclCG classDecl) { return classDecl.getMethods(); } @@ -225,8 +373,8 @@ public List getDecls(ADefaultClassDeclCG classDecl) return getAllDecls(classDecl, classes, methodDeclStrategy); } - public List getAllFields(ADefaultClassDeclCG classDecl, - List classes) + public List getAllFields(SClassDeclCG classDecl, + List classes) { DeclStrategy fieldDeclStrategy = new DeclStrategy() { @@ -237,7 +385,7 @@ public String getAccess(AFieldDeclCG decl) } @Override - public List getDecls(ADefaultClassDeclCG classDecl) + public List getDecls(SClassDeclCG classDecl) { return classDecl.getFields(); } @@ -268,9 +416,9 @@ public void setLocalDefs(List localDefs, } } - public ADefaultClassDeclCG findClass(List classes, String moduleName) + public SClassDeclCG findClass(List classes, String moduleName) { - for (ADefaultClassDeclCG classDecl : classes) + for (SClassDeclCG classDecl : classes) { if (classDecl.getName().equals(moduleName)) { @@ -282,7 +430,7 @@ public ADefaultClassDeclCG findClass(List classes, String m } // This method assumes that the record is defined in definingClass and not a super class - public ARecordDeclCG findRecord(ADefaultClassDeclCG definingClass, + public ARecordDeclCG findRecord(SClassDeclCG definingClass, String recordName) { for (ATypeDeclCG typeDecl : definingClass.getTypeDecls()) @@ -306,7 +454,7 @@ public ARecordDeclCG findRecord(ADefaultClassDeclCG definingClass, } // This method assumes that the record is defined in definingClass and not a super class - public List getRecords(ADefaultClassDeclCG definingClass) + public List getRecords(SClassDeclCG definingClass) { List records = new LinkedList(); @@ -327,10 +475,10 @@ public List getRecords(ADefaultClassDeclCG definingClass) return records; } - public ARecordDeclCG findRecord(List classes, + public ARecordDeclCG findRecord(List classes, ARecordTypeCG recordType) { - ADefaultClassDeclCG definingClass = findClass(classes, recordType.getName().getDefiningClass()); + SClassDeclCG definingClass = findClass(classes, recordType.getName().getDefiningClass()); ARecordDeclCG record = findRecord(definingClass, recordType.getName().getName()); return record; @@ -486,7 +634,7 @@ else if (typeCg instanceof ARealNumericBasicTypeCG) } } - public AFieldDeclCG getFieldDecl(List classes, + public AFieldDeclCG getFieldDecl(List classes, ARecordTypeCG recordType, int number) { ARecordDeclCG record = findRecord(classes, recordType); @@ -494,7 +642,7 @@ public AFieldDeclCG getFieldDecl(List classes, return record.getFields().get(number); } - public AFieldDeclCG getFieldDecl(ADefaultClassDeclCG clazz, String fieldName) + public AFieldDeclCG getFieldDecl(SClassDeclCG clazz, String fieldName) { for(AFieldDeclCG field : clazz.getFields()) { @@ -507,7 +655,7 @@ public AFieldDeclCG getFieldDecl(ADefaultClassDeclCG clazz, String fieldName) return null; } - public AFieldDeclCG getFieldDecl(List classes, + public AFieldDeclCG getFieldDecl(List classes, ARecordTypeCG recordType, String memberName) { ATypeNameCG name = recordType.getName(); @@ -534,8 +682,8 @@ public AFieldDeclCG getFieldDecl(List classes, + recordType); } - ADefaultClassDeclCG definingClass = null; - for (ADefaultClassDeclCG currentClass : classes) + SClassDeclCG definingClass = null; + for (SClassDeclCG currentClass : classes) { if (currentClass.getName().equals(definingClassName)) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ClassVisitorCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ClassVisitorCG.java index 31ee663b3b..60bcfedad7 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ClassVisitorCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ClassVisitorCG.java @@ -21,34 +21,19 @@ */ package org.overture.codegen.visitor; -import java.util.LinkedList; - import org.overture.ast.analysis.AnalysisException; +import org.overture.ast.definitions.ABusClassDefinition; import org.overture.ast.definitions.AClassClassDefinition; -import org.overture.ast.definitions.AExplicitOperationDefinition; -import org.overture.ast.definitions.PDefinition; -import org.overture.ast.intf.lex.ILexNameToken; -import org.overture.codegen.cgast.SDeclCG; -import org.overture.codegen.cgast.SPatternCG; +import org.overture.ast.definitions.ACpuClassDefinition; +import org.overture.ast.definitions.ASystemClassDefinition; +import org.overture.codegen.cgast.declarations.ABusClassDeclCG; +import org.overture.codegen.cgast.declarations.ACpuClassDeclCG; import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; -import org.overture.codegen.cgast.declarations.AFieldDeclCG; -import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; -import org.overture.codegen.cgast.declarations.AFuncDeclCG; -import org.overture.codegen.cgast.declarations.AMethodDeclCG; -import org.overture.codegen.cgast.declarations.AMutexSyncDeclCG; -import org.overture.codegen.cgast.declarations.ANamedTraceDeclCG; -import org.overture.codegen.cgast.declarations.APersyncDeclCG; -import org.overture.codegen.cgast.declarations.AThreadDeclCG; -import org.overture.codegen.cgast.declarations.ATypeDeclCG; -import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; -import org.overture.codegen.cgast.patterns.AIdentifierPatternCG; -import org.overture.codegen.cgast.statements.APlainCallStmCG; -import org.overture.codegen.cgast.types.AVoidTypeCG; -import org.overture.codegen.ir.IRGeneratedTag; +import org.overture.codegen.cgast.declarations.ASystemClassDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.ir.IRInfo; -import org.overture.codegen.logging.Logger; -public class ClassVisitorCG extends AbstractVisitorCG +public class ClassVisitorCG extends AbstractVisitorCG { public ClassVisitorCG() { @@ -58,140 +43,27 @@ public ClassVisitorCG() public ADefaultClassDeclCG caseAClassClassDefinition(AClassClassDefinition node, IRInfo question) throws AnalysisException { - String name = node.getName().getName(); - String access = node.getAccess().getAccess().toString(); - boolean isAbstract = node.getIsAbstract(); - boolean isStatic = false; - LinkedList superNames = node.getSupernames(); - - ADefaultClassDeclCG classCg = new ADefaultClassDeclCG(); - classCg.setPackage(null); - classCg.setName(name); - classCg.setAccess(access); - classCg.setAbstract(isAbstract); - classCg.setStatic(isStatic); - classCg.setStatic(false); - - if (superNames.size() >= 1) - { - classCg.setSuperName(superNames.get(0).getName()); - } - - LinkedList defs = node.getDefinitions(); - - for (PDefinition def : defs) - { - SDeclCG decl = def.apply(question.getDeclVisitor(), question); - - if (decl == null) - { - continue;// Unspported stuff returns null by default - } - if (decl instanceof AFieldDeclCG) - { - classCg.getFields().add((AFieldDeclCG) decl); - } else if (decl instanceof AMethodDeclCG) - { - - AMethodDeclCG method = (AMethodDeclCG) decl; - - if (method.getIsConstructor()) - { - String initName = question.getObjectInitializerCall((AExplicitOperationDefinition) def); - - AMethodDeclCG objInitializer = method.clone(); - objInitializer.setTag(new IRGeneratedTag(getClass().getName())); - objInitializer.setName(initName); - objInitializer.getMethodType().setResult(new AVoidTypeCG()); - objInitializer.setIsConstructor(false); - objInitializer.setPreCond(null); - objInitializer.setPostCond(null); - - classCg.getMethods().add(objInitializer); - - APlainCallStmCG initCall = new APlainCallStmCG(); - initCall.setType(objInitializer.getMethodType().getResult().clone()); - initCall.setClassType(null); - initCall.setName(initName); - - for (AFormalParamLocalParamCG param : method.getFormalParams()) - { - SPatternCG pattern = param.getPattern(); - - if (pattern instanceof AIdentifierPatternCG) - { - AIdentifierPatternCG idPattern = (AIdentifierPatternCG) pattern; - - AIdentifierVarExpCG var = new AIdentifierVarExpCG(); - var.setIsLocal(true); - var.setType(param.getType().clone()); - var.setName(idPattern.getName()); - var.setIsLambda(false); - var.setSourceNode(pattern.getSourceNode()); - - initCall.getArgs().add(var); - } - } - - method.setBody(initCall); - } - - classCg.getMethods().add(method); - } else if (decl instanceof ATypeDeclCG) - { - classCg.getTypeDecls().add((ATypeDeclCG) decl); - } else if (decl instanceof AFuncDeclCG) - { - classCg.getFunctions().add((AFuncDeclCG) decl); - } else if (decl instanceof AThreadDeclCG) - { - if (question.getSettings().generateConc()) - { - classCg.setThread((AThreadDeclCG) decl); - } - } - else if (decl instanceof APersyncDeclCG) - { - classCg.getPerSyncs().add((APersyncDeclCG) decl); - } - else if (decl instanceof AMutexSyncDeclCG) - { - classCg.getMutexSyncs().add((AMutexSyncDeclCG) decl); - } - else if(decl instanceof ANamedTraceDeclCG) - { - classCg.getTraces().add((ANamedTraceDeclCG) decl); - } - else - { - Logger.getLog().printErrorln("Unexpected definition in class: " - + name + ": " + def.getName().getName() + " at " + def.getLocation()); - } - } - - if(node.getInvariant() != null && question.getSettings().generateInvariants()) - { - SDeclCG invCg = node.getInvariant().apply(question.getDeclVisitor(), question); - classCg.setInvariant(invCg); - } - - boolean defaultConstructorExplicit = false; - for (AMethodDeclCG method : classCg.getMethods()) - { - if (method.getIsConstructor() && method.getFormalParams().isEmpty()) - { - defaultConstructorExplicit = true; - break; - } - } - - if (!defaultConstructorExplicit) - { - classCg.getMethods().add(question.getDeclAssistant().consDefaultContructor(name)); - } - - question.addClass(classCg); - - return classCg; + return question.getDeclAssistant().buildClass(node, question, new ADefaultClassDeclCG()); + } + + @Override + public SClassDeclCG caseACpuClassDefinition(ACpuClassDefinition node, IRInfo question) + throws AnalysisException + { + return question.getDeclAssistant().buildClass(node, question, new ACpuClassDeclCG()); + } + + @Override + public SClassDeclCG caseASystemClassDefinition(ASystemClassDefinition node, IRInfo question) + throws AnalysisException + { + return question.getDeclAssistant().buildClass(node, question, new ASystemClassDeclCG()); + } + + @Override + public SClassDeclCG caseABusClassDefinition(ABusClassDefinition node, IRInfo question) + throws AnalysisException + { + return question.getDeclAssistant().buildClass(node, question, new ABusClassDeclCG()); } } From a5021b7d680fa3127d8d19ccb22887478b1f1453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 22 Sep 2015 17:38:07 +0200 Subject: [PATCH 054/706] Update projects to support all types of IR classes --- .../overture/codegen/vdm2java/JavaFormat.java | 2 -- .../codegen/vdm2java/JavaValueSemantics.java | 3 ++- .../overture/codegen/assistant/DeclStrategy.java | 4 ++-- .../codegen/assistant/TypeAssistantCG.java | 16 ++++++++-------- .../org/overture/codegen/ir/IRGenerator.java | 4 ++-- .../java/org/overture/codegen/ir/IRInfo.java | 16 ++++++++-------- .../codegen/traces/TraceStmsBuilder.java | 6 +++--- .../codegen/trans/conc/MainClassConcTrans.java | 14 ++++++++------ .../codegen/trans/uniontypes/UnionTypeTrans.java | 5 +++-- .../overture/codegen/visitor/VisitorManager.java | 8 ++++---- 10 files changed, 40 insertions(+), 38 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java index 1ef0516b6c..cdc5531b40 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java @@ -48,13 +48,11 @@ import org.overture.codegen.cgast.expressions.AApplyExpCG; import org.overture.codegen.cgast.expressions.ABoolLiteralExpCG; import org.overture.codegen.cgast.expressions.ACastUnaryExpCG; -import org.overture.codegen.cgast.expressions.AEnumMapExpCG; import org.overture.codegen.cgast.expressions.AEqualsBinaryExpCG; import org.overture.codegen.cgast.expressions.AFieldNumberExpCG; import org.overture.codegen.cgast.expressions.AHeadUnaryExpCG; import org.overture.codegen.cgast.expressions.AHistoryExpCG; import org.overture.codegen.cgast.expressions.AIsolationUnaryExpCG; -import org.overture.codegen.cgast.expressions.AMapletExpCG; import org.overture.codegen.cgast.expressions.AMinusUnaryExpCG; import org.overture.codegen.cgast.expressions.ANewExpCG; import org.overture.codegen.cgast.expressions.ANotEqualsBinaryExpCG; diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaValueSemantics.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaValueSemantics.java index e6f9627b1c..bec4345642 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaValueSemantics.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaValueSemantics.java @@ -31,6 +31,7 @@ import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.cgast.expressions.AAddrEqualsBinaryExpCG; import org.overture.codegen.cgast.expressions.AAddrNotEqualsBinaryExpCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; @@ -186,7 +187,7 @@ public boolean cloneMember(AFieldExpCG exp) String memberName = exp.getMemberName(); - List classes = javaFormat.getIrInfo().getClasses(); + List classes = javaFormat.getIrInfo().getClasses(); AssistantManager assistantManager = javaFormat.getIrInfo().getAssistantManager(); AFieldDeclCG memberField = assistantManager.getDeclAssistant().getFieldDecl(classes, recordType, memberName); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclStrategy.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclStrategy.java index f321d6502e..a863f4c95c 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclStrategy.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclStrategy.java @@ -24,11 +24,11 @@ import java.util.List; import org.overture.codegen.cgast.SDeclCG; -import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; public interface DeclStrategy { public String getAccess(T decl); - public List getDecls(ADefaultClassDeclCG classDecl); + public List getDecls(SClassDeclCG classDecl); } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java index 03e57b94a5..573013bc96 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java @@ -44,10 +44,10 @@ import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.SObjectDesignatorCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; import org.overture.codegen.cgast.expressions.SBinaryExpCG; import org.overture.codegen.cgast.statements.AApplyObjectDesignatorCG; @@ -107,7 +107,7 @@ public STypeCG getFieldExpType(IRInfo info, String fieldName, String fieldModule if (fieldModule != null) { // It is a class - ADefaultClassDeclCG clazz = info.getDeclAssistant().findClass(info.getClasses(), fieldModule); + SClassDeclCG clazz = info.getDeclAssistant().findClass(info.getClasses(), fieldModule); AFieldDeclCG field = info.getDeclAssistant().getFieldDecl(clazz, fieldModule); if(field != null) @@ -163,7 +163,7 @@ public AMethodTypeCG getMethodType(IRInfo info, String fieldModule, String fieldName, List args) throws org.overture.codegen.cgast.analysis.AnalysisException { - ADefaultClassDeclCG classDecl = assistantManager.getDeclAssistant().findClass(info.getClasses(), fieldModule); + SClassDeclCG classDecl = assistantManager.getDeclAssistant().findClass(info.getClasses(), fieldModule); List methods = assistantManager.getDeclAssistant().getAllMethods(classDecl, info.getClasses()); @@ -193,8 +193,8 @@ public AMethodTypeCG getMethodType(IRInfo info, return null; } - public STypeCG getFieldType(ADefaultClassDeclCG classDecl, String fieldName, - List classes) + public STypeCG getFieldType(SClassDeclCG classDecl, String fieldName, + List classes) { for (AFieldDeclCG field : assistantManager.getDeclAssistant().getAllFields(classDecl, classes)) { @@ -207,7 +207,7 @@ public STypeCG getFieldType(ADefaultClassDeclCG classDecl, String fieldName, return null; } - public STypeCG getFieldType(List classes, + public STypeCG getFieldType(List classes, ARecordTypeCG recordType, String memberName) { AFieldDeclCG field = assistantManager.getDeclAssistant().getFieldDecl(classes, recordType, memberName); @@ -231,10 +231,10 @@ public List getFieldTypes(ARecordDeclCG record) return fieldTypes; } - public STypeCG getFieldType(List classes, String moduleName, + public STypeCG getFieldType(List classes, String moduleName, String fieldName) { - ADefaultClassDeclCG classDecl = assistantManager.getDeclAssistant().findClass(classes, moduleName); + SClassDeclCG classDecl = assistantManager.getDeclAssistant().findClass(classes, moduleName); return getFieldType(classDecl, fieldName, classes); } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java index d047fcbc79..fe3f26baa5 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRGenerator.java @@ -36,8 +36,8 @@ import org.overture.codegen.analysis.vdm.IdStateDesignatorDefCollector; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.SExpCG; -import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.trans.ITotalTransformation; public class IRGenerator @@ -85,7 +85,7 @@ public IRStatus generateFrom(org.overture.ast.node.INode node) if(node instanceof SClassDefinition) { - ADefaultClassDeclCG classCg = node.apply(codeGenInfo.getClassVisitor(), codeGenInfo); + SClassDeclCG classCg = node.apply(codeGenInfo.getClassVisitor(), codeGenInfo); Set unsupportedNodes = new HashSet(codeGenInfo.getUnsupportedNodes()); String name = ((SClassDefinition) node).getName().getName(); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java index 82f4ff5c2c..f20097cb76 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRInfo.java @@ -58,8 +58,8 @@ import org.overture.codegen.cgast.STraceCoreDeclCG; import org.overture.codegen.cgast.STraceDeclCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.logging.Logger; import org.overture.codegen.visitor.CGVisitor; import org.overture.codegen.visitor.VisitorManager; @@ -101,7 +101,7 @@ public class IRInfo private Map idStateDesignatorDefs; // IR classes - private List classes; + private List classes; // IR modules private List modules; @@ -124,7 +124,7 @@ public IRInfo(String objectInitCallPrefix) this.objectInitCallNames = new HashMap(); this.idStateDesignatorDefs = new HashMap(); - this.classes = new LinkedList(); + this.classes = new LinkedList(); this.modules = new LinkedList(); } @@ -133,7 +133,7 @@ public AssistantManager getAssistantManager() return assistantManager; } - public CGVisitor getClassVisitor() + public CGVisitor getClassVisitor() { return visitorManager.getClassVisitor(); } @@ -383,12 +383,12 @@ public void setIdStateDesignatorDefs(Map getClasses() + public List getClasses() { return classes; } - public void addClass(ADefaultClassDeclCG irClass) + public void addClass(SClassDeclCG irClass) { if(this.classes != null) { @@ -398,9 +398,9 @@ public void addClass(ADefaultClassDeclCG irClass) public void removeClass(String name) { - ADefaultClassDeclCG classToRemove = null; + SClassDeclCG classToRemove = null; - for (ADefaultClassDeclCG clazz : classes) + for (SClassDeclCG clazz : classes) { if(clazz.getName().equals(name)) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceStmsBuilder.java b/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceStmsBuilder.java index ea93f2ff3e..bd9a76c967 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceStmsBuilder.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceStmsBuilder.java @@ -16,10 +16,10 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.AnswerAdaptor; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.cgast.expressions.AAnonymousClassExpCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; import org.overture.codegen.cgast.expressions.ACastUnaryExpCG; @@ -65,7 +65,7 @@ public class TraceStmsBuilder extends AnswerAdaptor { private IRInfo info; - private List classes; + private List classes; private TransAssistantCG transAssistant; private IterationVarPrefixes iteVarPrefixes; private ILanguageIterator langIterator; @@ -78,7 +78,7 @@ public class TraceStmsBuilder extends AnswerAdaptor private Map idConstNameMap; - public TraceStmsBuilder(IRInfo info, List classes, + public TraceStmsBuilder(IRInfo info, List classes, TransAssistantCG transAssistant, IterationVarPrefixes iteVarPrefixes, TraceNames tracePrefixes, ILanguageIterator langIterator, ICallStmToStringMethodBuilder toStringBuilder, diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MainClassConcTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MainClassConcTrans.java index 74c7448656..9e7c32acec 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MainClassConcTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/conc/MainClassConcTrans.java @@ -13,6 +13,7 @@ import org.overture.codegen.cgast.declarations.AInterfaceDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.APersyncDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.cgast.expressions.ABoolLiteralExpCG; import org.overture.codegen.cgast.expressions.ACastUnaryExpCG; import org.overture.codegen.cgast.expressions.AEqualsBinaryExpCG; @@ -46,6 +47,7 @@ */ public class MainClassConcTrans extends DepthFirstAnalysisAdaptor { + private static final String VDM_THREAD = "VDMThread"; private IRInfo info; public MainClassConcTrans(IRInfo info) @@ -299,21 +301,21 @@ private boolean isIRGenerated(AMethodDeclCG method) private void makeThread(ADefaultClassDeclCG node) { - ADefaultClassDeclCG threadClass = getThreadClass(node.getSuperName(), node); - threadClass.setSuperName("VDMThread"); + SClassDeclCG threadClass = getThreadClass(node.getSuperName(), node); + threadClass.setSuperName(VDM_THREAD); } - private ADefaultClassDeclCG getThreadClass(String superName, ADefaultClassDeclCG classCg) + private SClassDeclCG getThreadClass(String superName, SClassDeclCG classCg) { - if(superName == null || superName.equals("VDMThread")) + if(superName == null || superName.equals(VDM_THREAD)) { return classCg; } else { - ADefaultClassDeclCG superClass = null; + SClassDeclCG superClass = null; - for(ADefaultClassDeclCG c : info.getClasses()) + for(SClassDeclCG c : info.getClasses()) { if(c.getName().equals(superName)) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java index 17583074a2..fe4cd76fa0 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java @@ -38,6 +38,7 @@ import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.cgast.expressions.AApplyExpCG; import org.overture.codegen.cgast.expressions.ACardUnaryExpCG; import org.overture.codegen.cgast.expressions.ACastUnaryExpCG; @@ -612,7 +613,7 @@ public void inANewExpCG(ANewExpCG node) throws AnalysisException if (type instanceof AClassTypeCG) { - for (ADefaultClassDeclCG classCg : transAssistant.getInfo().getClasses()) + for (SClassDeclCG classCg : transAssistant.getInfo().getClasses()) { for (AMethodDeclCG method : classCg.getMethods()) { @@ -633,7 +634,7 @@ public void inANewExpCG(ANewExpCG node) throws AnalysisException String definingClassName = recordType.getName().getDefiningClass(); String recordName = recordType.getName().getName(); - ADefaultClassDeclCG classDecl = transAssistant.getInfo().getAssistantManager().getDeclAssistant().findClass(transAssistant.getInfo().getClasses(), definingClassName); + SClassDeclCG classDecl = transAssistant.getInfo().getAssistantManager().getDeclAssistant().findClass(transAssistant.getInfo().getClasses(), definingClassName); ARecordDeclCG record = transAssistant.getInfo().getAssistantManager().getDeclAssistant().findRecord(classDecl, recordName); List fieldTypes = transAssistant.getInfo().getAssistantManager().getTypeAssistant().getFieldTypes(record); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/VisitorManager.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/VisitorManager.java index be9a11009d..77fdb4b021 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/VisitorManager.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/VisitorManager.java @@ -38,15 +38,15 @@ import org.overture.codegen.cgast.STraceCoreDeclCG; import org.overture.codegen.cgast.STraceDeclCG; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; +import org.overture.codegen.cgast.declarations.SClassDeclCG; import org.overture.codegen.traces.TermVisitorCG; import org.overture.codegen.traces.TraceCoreDeclVisitorCG; import org.overture.codegen.traces.TraceDeclVisitorCG; public class VisitorManager { - private CGVisitor classVisitor; + private CGVisitor classVisitor; private CGVisitor moduleVisitor; private CGVisitor importsVisitor; private CGVisitor importVisitor; @@ -68,7 +68,7 @@ public class VisitorManager public VisitorManager() { - this.classVisitor = new CGVisitor(new ClassVisitorCG()); + this.classVisitor = new CGVisitor(new ClassVisitorCG()); this.moduleVisitor = new CGVisitor(new ModuleVisitorCG()); this.importsVisitor = new CGVisitor(new ImportsVisitorCG()); this.importVisitor = new CGVisitor(new ImportVisitorCG()); @@ -89,7 +89,7 @@ public VisitorManager() this.traceCoreDeclVisitor = new CGVisitor(new TraceCoreDeclVisitorCG()); } - public CGVisitor getClassVisitor() + public CGVisitor getClassVisitor() { return classVisitor; } From dc7081d7f4b952d004f6d6e8c9ecdd2fe18a4d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 22 Sep 2015 17:53:43 +0200 Subject: [PATCH 055/706] Collect definitions for the 'System' class also --- .../analysis/vdm/IdStateDesignatorDefCollector.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/IdStateDesignatorDefCollector.java b/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/IdStateDesignatorDefCollector.java index 87c5b402d3..243abff44d 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/IdStateDesignatorDefCollector.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/IdStateDesignatorDefCollector.java @@ -14,9 +14,11 @@ import org.overture.ast.definitions.AInheritedDefinition; import org.overture.ast.definitions.AInstanceVariableDefinition; import org.overture.ast.definitions.AStateDefinition; +import org.overture.ast.definitions.ASystemClassDefinition; import org.overture.ast.definitions.AThreadDefinition; import org.overture.ast.definitions.AValueDefinition; import org.overture.ast.definitions.PDefinition; +import org.overture.ast.definitions.SClassDefinition; import org.overture.ast.intf.lex.ILexNameToken; import org.overture.ast.modules.AModuleModules; import org.overture.ast.node.INode; @@ -65,6 +67,17 @@ public static Map getIdDefs(List Date: Sat, 3 Oct 2015 02:54:47 +0200 Subject: [PATCH 056/706] Update result files with checking of optional types --- .../AtomicStateInvNoViolation/Entry.java | 4 ++ .../atomic/AtomicStateInvNoViolation/St.java | 8 ++- .../AtomicStateInvViolation.vdmsl.result | 2 +- .../atomic/AtomicStateInvViolation/Entry.java | 4 ++ .../atomic/AtomicStateInvViolation/St.java | 8 ++- .../MaskedRecInvViolated/Entry.java | 16 +++++- .../MaskedRecInvViolated.vdmsl.result | 8 +-- .../MaskedRecInvViolated/R1.java | 8 ++- .../MaskedRecInvViolated/R2.java | 8 +-- .../MaskedRecInvViolated/R3.java | 8 ++- .../MaskedRecInvViolated/R4.java | 8 ++- .../MaskedRecNamedTypeInv/Entry.java | 15 ++++- .../MaskedRecNamedTypeInv.vdmsl.result | 2 +- .../MaskedRecNamedTypeInv/R1.java | 8 ++- .../MaskedRecNamedTypeInv/R2.java | 8 +-- .../MaskedRecNamedTypeInv/R3.java | 8 ++- .../MaskedRecNamedTypeInv/R4.java | 8 ++- .../complexstatedes/ModifyRecInMap/A.java | 8 ++- .../complexstatedes/ModifyRecInMap/B.java | 8 ++- .../complexstatedes/ModifyRecInMap/Entry.java | 14 ++++- .../ModifyRecInMap.vdmsl.result | 2 +- .../NamedTypeInvUnionTypeRec/Entry.java | 24 +++++++- .../NamedTypeInvUnionTypeRec.vdmsl.result | 8 +-- .../NamedTypeInvUnionTypeRec/R1.java | 8 ++- .../NamedTypeInvUnionTypeRec/R2.java | 10 ++-- .../NamedTypeInvUnionTypeRec/R3.java | 8 ++- .../NamedTypeInvUnionTypeRec/R4.java | 8 ++- .../NamedTypeInvUnionTypeRec/X.java | 8 ++- .../RecInRecInAtomic/Entry.java | 15 ++++- .../complexstatedes/RecInRecInAtomic/R1.java | 8 ++- .../complexstatedes/RecInRecInAtomic/R2.java | 8 ++- .../complexstatedes/RecInRecInAtomic/R3.java | 8 ++- .../RecInRecInAtomic.vdmsl.result | 4 +- .../RecInRecInvViolation/Entry.java | 16 +++++- .../RecInRecInvViolation.vdmsl.result | 56 +++++++++---------- .../RecInRecInvViolation/T1.java | 8 ++- .../RecInRecInvViolation/T2.java | 8 ++- .../RecInRecInvViolation/T3.java | 8 ++- .../RecInRecInvViolation/T4.java | 8 ++- .../complexstatedes/RecWithMapOfRec/A.java | 8 ++- .../complexstatedes/RecWithMapOfRec/B.java | 8 ++- .../RecWithMapOfRec/Entry.java | 14 ++++- .../RecWithMapOfRec.vdmsl.result | 2 +- .../NamedTypeInvAsssignments/Entry.java | 11 ++++ .../NamedTypeInvAsssignments.vdmsl.result | 2 +- .../NamedTypeInvMethodParam/Entry.java | 2 + .../NamedTypeInvMethodParam.vdmsl.result | 2 +- .../prepost/PostCond/Entry.java | 53 +++++++++++++++--- .../prepost/PostCond/PostCond.vdmsl.result | 4 +- .../dynamic_analysis/prepost/PostCond/St.java | 8 ++- .../prepost/PreCond/Entry.java | 43 ++++++++++++-- .../prepost/PreCond/PreCond.vdmsl.result | 2 +- .../dynamic_analysis/prepost/PreCond/St.java | 8 ++- .../recinv/RecTypeDefInv/Rec.java | 16 +++++- .../recinv/StateInitViolatesInv/St.java | 8 ++- .../recinv/StateInv/Entry.java | 7 +++ .../dynamic_analysis/recinv/StateInv/St.java | 8 ++- .../recinv/StateInv/StateInv.vdmsl.result | 4 +- 58 files changed, 476 insertions(+), 118 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java index d99a6efb8d..6db3365b44 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java @@ -24,7 +24,11 @@ public static Object Run() { { /* Start of atomic statement */ //@ set invChecksOn = false; + + //@ assert St != null; St.set_x(atomicTmp_1); + + //@ assert St != null; St.set_x(atomicTmp_2); //@ set invChecksOn = true; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java index fba0dd9d0f..ec4e67404a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_1 = x; + + //@ assert ret_1 != null; + return ret_1; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result index 907ca78458..42addc4758 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result @@ -1,5 +1,5 @@ "Before first atomic (expecting violation after atomic)" -St.java:54: JML invariant is false on leaving method project.Entrytypes.St.valid() +St.java:60: JML invariant is false on leaving method project.Entrytypes.St.valid() public Boolean valid() { ^ St.java:13: Associated declaration diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java index 91739d20dc..6f10a9935a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java @@ -22,6 +22,8 @@ public static Object Run() { { /* Start of atomic statement */ //@ set invChecksOn = false; + + //@ assert St != null; St.set_x(atomicTmp_1); //@ set invChecksOn = true; @@ -36,6 +38,8 @@ public static Object Run() { { /* Start of atomic statement */ //@ set invChecksOn = false; + + //@ assert St != null; St.set_x(atomicTmp_2); //@ set invChecksOn = true; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java index fba0dd9d0f..ec4e67404a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_1 = x; + + //@ assert ret_1 != null; + return ret_1; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java index f19b8c9979..bcbd25b111 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java @@ -18,6 +18,8 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); + //@ assert ignorePattern_1 != null; + /* skip */ } @@ -27,6 +29,8 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); + //@ assert ignorePattern_2 != null; + /* skip */ } @@ -53,6 +57,7 @@ public static Number useOk() { project.Entrytypes.R4 stateDes_3 = stateDes_2.get_r4(); + //@ assert stateDes_3 != null; stateDes_3.set_x(atomicTmp_1); project.Entrytypes.R2 stateDes_4 = r1.get_r2(); @@ -61,6 +66,7 @@ public static Number useOk() { project.Entrytypes.R4 stateDes_6 = stateDes_5.get_r4(); + //@ assert stateDes_6 != null; stateDes_6.set_x(atomicTmp_2); project.Entrytypes.R2 stateDes_7 = r1.get_r2(); @@ -69,6 +75,7 @@ public static Number useOk() { project.Entrytypes.R4 stateDes_9 = stateDes_8.get_r4(); + //@ assert stateDes_9 != null; stateDes_9.set_x(atomicTmp_3); //@ set invChecksOn = true; @@ -96,7 +103,9 @@ public static Number useOk() { //@ assert stateDes_7.valid(); } /* End of atomic statement */ - return 0L; + Number ret_1 = 0L; + + return ret_1; } public static Number useNotOk() { @@ -113,6 +122,7 @@ public static Number useNotOk() { project.Entrytypes.R4 stateDes_12 = stateDes_11.get_r4(); + //@ assert stateDes_12 != null; stateDes_12.set_x(atomicTmp_4); //@ set invChecksOn = true; @@ -126,7 +136,9 @@ public static Number useNotOk() { //@ assert r1.valid(); } /* End of atomic statement */ - return 0L; + Number ret_2 = 0L; + + return ret_2; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result index 4d1afce492..3980471011 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result @@ -1,10 +1,10 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:54: JML invariant is false on leaving method project.Entrytypes.R3.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:60: JML invariant is false on leaving method project.Entrytypes.R3.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:54: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:60: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:19: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) @@ -13,10 +13,10 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:19: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:146: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:158: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) return !(Utils.equals(t3.get_r4().get_x(), 10L)); ^ -Entry.java:146: +Entry.java:158: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:45: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java index 905b6ef265..cb0226cca0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R2 get_r2() { - return r2; + project.Entrytypes.R2 ret_3 = r2; + + //@ assert ret_3 != null; + return ret_3; } public void set_r2(final project.Entrytypes.R2 _r2) { + //@ assert _r2 != null; r2 = _r2; + + //@ assert r2 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java index b4dec1d1ca..54eeed78f0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java @@ -48,11 +48,11 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R3 get_t3() { - project.Entrytypes.R3 ret_1 = t3; + project.Entrytypes.R3 ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> ret_1.valid(); - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_1)); - return ret_1; + //@ assert project.Entry.invChecksOn ==> ret_4.valid(); + //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); + return ret_4; } public void set_t3(final project.Entrytypes.R3 _t3) { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java index 6c2c2ffcd2..d917544456 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R4 get_r4() { - return r4; + project.Entrytypes.R4 ret_5 = r4; + + //@ assert ret_5 != null; + return ret_5; } public void set_r4(final project.Entrytypes.R4 _r4) { + //@ assert _r4 != null; r4 = _r4; + + //@ assert r4 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java index 9e9971f134..33b419af2a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_6 = x; + + //@ assert ret_6 != null; + return ret_6; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java index eff873e809..073035e4ae 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java @@ -18,6 +18,8 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); + //@ assert ignorePattern_1 != null; + /* skip */ } @@ -27,6 +29,8 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); + //@ assert ignorePattern_2 != null; + /* skip */ } @@ -51,6 +55,7 @@ public static Number useOk() { project.Entrytypes.R4 stateDes_3 = stateDes_2.get_r4(); + //@ assert stateDes_3 != null; stateDes_3.set_x(atomicTmp_1); project.Entrytypes.R2 stateDes_4 = r1.get_r2(); @@ -59,6 +64,7 @@ public static Number useOk() { project.Entrytypes.R4 stateDes_6 = stateDes_5.get_r4(); + //@ assert stateDes_6 != null; stateDes_6.set_x(atomicTmp_2); //@ set invChecksOn = true; @@ -79,7 +85,9 @@ public static Number useOk() { //@ assert stateDes_4.valid(); } /* End of atomic statement */ - return 0L; + Number ret_1 = 0L; + + return ret_1; } public static Number useNotOk() { @@ -96,6 +104,7 @@ public static Number useNotOk() { project.Entrytypes.R4 stateDes_9 = stateDes_8.get_r4(); + //@ assert stateDes_9 != null; stateDes_9.set_x(atomicTmp_3); //@ set invChecksOn = true; @@ -109,7 +118,9 @@ public static Number useNotOk() { //@ assert r1.valid(); } /* End of atomic statement */ - return 0L; + Number ret_2 = 0L; + + return ret_2; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result index 229f9edc58..4c627ab848 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -Entry.java:106: JML assertion is false +Entry.java:115: JML assertion is false //@ assert inv_Entry_T3(stateDes_8); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java index 905b6ef265..cb0226cca0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R2 get_r2() { - return r2; + project.Entrytypes.R2 ret_3 = r2; + + //@ assert ret_3 != null; + return ret_3; } public void set_r2(final project.Entrytypes.R2 _r2) { + //@ assert _r2 != null; r2 = _r2; + + //@ assert r2 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java index b4dec1d1ca..54eeed78f0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java @@ -48,11 +48,11 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R3 get_t3() { - project.Entrytypes.R3 ret_1 = t3; + project.Entrytypes.R3 ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> ret_1.valid(); - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_1)); - return ret_1; + //@ assert project.Entry.invChecksOn ==> ret_4.valid(); + //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); + return ret_4; } public void set_t3(final project.Entrytypes.R3 _t3) { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java index 6c2c2ffcd2..d917544456 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R4 get_r4() { - return r4; + project.Entrytypes.R4 ret_5 = r4; + + //@ assert ret_5 != null; + return ret_5; } public void set_r4(final project.Entrytypes.R4 _r4) { + //@ assert _r4 != null; r4 = _r4; + + //@ assert r4 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java index 9e9971f134..33b419af2a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_6 = x; + + //@ assert ret_6 != null; + return ret_6; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java index 9976a5215c..b7e610eacb 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public VDMMap get_m() { - return m; + VDMMap ret_3 = m; + + //@ assert ret_3 != null; + return ret_3; } public void set_m(final VDMMap _m) { + //@ assert _m != null; m = _m; + + //@ assert m != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java index 492999808a..d2a70a3d4f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java @@ -42,11 +42,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_4 = x; + + //@ assert ret_4 != null; + return ret_4; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java index 207d1cd8c8..7ad76f7d25 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java @@ -18,6 +18,8 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); + //@ assert ignorePattern_1 != null; + /* skip */ } @@ -27,6 +29,8 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); + //@ assert ignorePattern_2 != null; + /* skip */ } @@ -43,10 +47,13 @@ public static Number useOk() { project.Entrytypes.B stateDes_2 = ((project.Entrytypes.B) Utils.get(stateDes_1, 1L)); + //@ assert stateDes_2 != null; stateDes_2.set_x(2L); //@ assert a.valid(); - return 0L; + Number ret_1 = 0L; + + return ret_1; } public static Number useNotOk() { @@ -57,10 +64,13 @@ public static Number useNotOk() { project.Entrytypes.B stateDes_4 = ((project.Entrytypes.B) Utils.get(stateDes_3, 1L)); + //@ assert stateDes_4 != null; stateDes_4.set_x(1L); //@ assert a.valid(); - return 0L; + Number ret_2 = 0L; + + return ret_2; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result index 85b789ce6c..7b91606957 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:54: JML invariant is false on leaving method project.Entrytypes.A.valid() +A.java:60: JML invariant is false on leaving method project.Entrytypes.A.valid() public Boolean valid() { ^ A.java:13: Associated declaration diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index 60b096e257..b5a3d29283 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -18,6 +18,8 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); + //@ assert ignorePattern_1 != null; + /* skip */ } @@ -27,6 +29,8 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); + //@ assert ignorePattern_2 != null; + /* skip */ } @@ -55,11 +59,14 @@ public static Number useOk() { if (stateDes_2 instanceof project.Entrytypes.R3) { apply_1 = ((project.Entrytypes.R3) stateDes_2).get_r4(); + + //@ assert apply_1 != null; } else { throw new RuntimeException("Missing member: r4"); } project.Entrytypes.R4 stateDes_3 = apply_1; + //@ assert stateDes_3 != null; stateDes_3.set_x(atomicTmp_1); project.Entrytypes.R2 stateDes_4 = r1.get_r2(); @@ -70,11 +77,14 @@ public static Number useOk() { if (stateDes_5 instanceof project.Entrytypes.R3) { apply_2 = ((project.Entrytypes.R3) stateDes_5).get_r4(); + + //@ assert apply_2 != null; } else { throw new RuntimeException("Missing member: r4"); } project.Entrytypes.R4 stateDes_6 = apply_2; + //@ assert stateDes_6 != null; stateDes_6.set_x(atomicTmp_2); project.Entrytypes.R2 stateDes_7 = r1.get_r2(); @@ -85,11 +95,14 @@ public static Number useOk() { if (stateDes_8 instanceof project.Entrytypes.R3) { apply_3 = ((project.Entrytypes.R3) stateDes_8).get_r4(); + + //@ assert apply_3 != null; } else { throw new RuntimeException("Missing member: r4"); } project.Entrytypes.R4 stateDes_9 = apply_3; + //@ assert stateDes_9 != null; stateDes_9.set_x(atomicTmp_3); //@ set invChecksOn = true; @@ -120,7 +133,9 @@ public static Number useOk() { //@ assert stateDes_7.valid(); } /* End of atomic statement */ - return 0L; + Number ret_1 = 0L; + + return ret_1; } public static Number useNotOk() { @@ -139,11 +154,14 @@ public static Number useNotOk() { if (stateDes_11 instanceof project.Entrytypes.R3) { apply_4 = ((project.Entrytypes.R3) stateDes_11).get_r4(); + + //@ assert apply_4 != null; } else { throw new RuntimeException("Missing member: r4"); } project.Entrytypes.R4 stateDes_12 = apply_4; + //@ assert stateDes_12 != null; stateDes_12.set_x(atomicTmp_4); //@ set invChecksOn = true; @@ -158,7 +176,9 @@ public static Number useNotOk() { //@ assert r1.valid(); } /* End of atomic statement */ - return 0L; + Number ret_2 = 0L; + + return ret_2; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result index d09537061f..0efe3fad10 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result @@ -1,10 +1,10 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:54: JML invariant is false on leaving method project.Entrytypes.R3.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:60: JML invariant is false on leaving method project.Entrytypes.R3.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:54: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:60: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:19: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) @@ -13,10 +13,10 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:19: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:189: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:209: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) apply_9 = ((project.Entrytypes.R3) t3).get_r4(); ^ -Entry.java:189: +Entry.java:209: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:45: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java index 0eacf4d574..caacb3a69a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R2 get_r2() { - return r2; + project.Entrytypes.R2 ret_3 = r2; + + //@ assert ret_3 != null; + return ret_3; } public void set_r2(final project.Entrytypes.R2 _r2) { + //@ assert _r2 != null; r2 = _r2; + + //@ assert r2 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java index 39d0ff06e4..9ca122fee8 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java @@ -50,12 +50,12 @@ public String toString() { /*@ pure @*/ public Object get_t3() { - Object ret_1 = t3; + Object ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> ret_1 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) ret_1).valid(); - //@ assert project.Entry.invChecksOn ==> ret_1 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) ret_1).valid(); - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_1)); - return ret_1; + //@ assert project.Entry.invChecksOn ==> ret_4 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) ret_4).valid(); + //@ assert project.Entry.invChecksOn ==> ret_4 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) ret_4).valid(); + //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); + return ret_4; } public void set_t3(final Object _t3) { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java index c96e504808..240415c866 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R4 get_r4() { - return r4; + project.Entrytypes.R4 ret_5 = r4; + + //@ assert ret_5 != null; + return ret_5; } public void set_r4(final project.Entrytypes.R4 _r4) { + //@ assert _r4 != null; r4 = _r4; + + //@ assert r4 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java index 47285d57ff..cf543111c2 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_6 = x; + + //@ assert ret_6 != null; + return ret_6; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java index b7eb23334d..820fdc351e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java @@ -42,11 +42,17 @@ public String toString() { /*@ pure @*/ public Boolean get_b() { - return b; + Boolean ret_7 = b; + + //@ assert ret_7 != null; + return ret_7; } public void set_b(final Boolean _b) { + //@ assert _b != null; b = _b; + + //@ assert b != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java index da76e59c8c..3e9df3cbde 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java @@ -18,6 +18,8 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); + //@ assert ignorePattern_1 != null; + /* skip */ } @@ -27,6 +29,8 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); + //@ assert ignorePattern_2 != null; + /* skip */ } @@ -49,12 +53,14 @@ public static Number useOk() { project.Entrytypes.R3 stateDes_2 = stateDes_1.get_r3(); + //@ assert stateDes_2 != null; stateDes_2.set_x(atomicTmp_1); project.Entrytypes.R2 stateDes_3 = r1.get_r2(); project.Entrytypes.R3 stateDes_4 = stateDes_3.get_r3(); + //@ assert stateDes_4 != null; stateDes_4.set_x(atomicTmp_2); //@ set invChecksOn = true; @@ -69,7 +75,9 @@ public static Number useOk() { //@ assert stateDes_3.valid(); } /* End of atomic statement */ - return 0L; + Number ret_1 = 0L; + + return ret_1; } public static Number useNotOk() { @@ -84,6 +92,7 @@ public static Number useNotOk() { project.Entrytypes.R3 stateDes_6 = stateDes_5.get_r3(); + //@ assert stateDes_6 != null; stateDes_6.set_x(atomicTmp_3); //@ set invChecksOn = true; @@ -94,7 +103,9 @@ public static Number useNotOk() { //@ assert r1.valid(); } /* End of atomic statement */ - return 0L; + Number ret_2 = 0L; + + return ret_2; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java index 6fecafa212..5034b5bfe5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R2 get_r2() { - return r2; + project.Entrytypes.R2 ret_3 = r2; + + //@ assert ret_3 != null; + return ret_3; } public void set_r2(final project.Entrytypes.R2 _r2) { + //@ assert _r2 != null; r2 = _r2; + + //@ assert r2 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java index e91adc5d8e..1ccd32ebe4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.R3 get_r3() { - return r3; + project.Entrytypes.R3 ret_4 = r3; + + //@ assert ret_4 != null; + return ret_4; } public void set_r3(final project.Entrytypes.R3 _r3) { + //@ assert _r3 != null; r3 = _r3; + + //@ assert r3 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java index bd8e1b12d4..673a576cb2 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_5 = x; + + //@ assert ret_5 != null; + return ret_5; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result index 3553ce115d..bf78464d94 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result @@ -1,10 +1,10 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:54: JML invariant is false on leaving method project.Entrytypes.R1.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:60: JML invariant is false on leaving method project.Entrytypes.R1.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:54: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:60: //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java index 84f8313d1f..83d5849c07 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java @@ -21,6 +21,7 @@ public static Number useOk() { project.Entrytypes.T4 stateDes_3 = stateDes_2.get_t4(); + //@ assert stateDes_3 != null; stateDes_3.set_x(6L); //@ assert stateDes_2.valid(); @@ -34,6 +35,7 @@ public static Number useOk() { project.Entrytypes.T4 stateDes_6 = stateDes_5.get_t4(); + //@ assert stateDes_6 != null; stateDes_6.set_x(7L); //@ assert stateDes_5.valid(); @@ -41,7 +43,9 @@ public static Number useOk() { //@ assert stateDes_4.valid(); //@ assert t1.valid(); - return 0L; + Number ret_1 = 0L; + + return ret_1; } public static Number useNotOk() { @@ -53,6 +57,7 @@ public static Number useNotOk() { project.Entrytypes.T4 stateDes_9 = stateDes_8.get_t4(); + //@ assert stateDes_9 != null; stateDes_9.set_x(60L); //@ assert stateDes_8.valid(); @@ -66,6 +71,7 @@ public static Number useNotOk() { project.Entrytypes.T4 stateDes_12 = stateDes_11.get_t4(); + //@ assert stateDes_12 != null; stateDes_12.set_x(5L); //@ assert stateDes_11.valid(); @@ -73,7 +79,9 @@ public static Number useNotOk() { //@ assert stateDes_10.valid(); //@ assert t1.valid(); - return 0L; + Number ret_2 = 0L; + + return ret_2; } public static Object Run() { @@ -82,6 +90,8 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); + //@ assert ignorePattern_1 != null; + /* skip */ } @@ -91,6 +101,8 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); + //@ assert ignorePattern_2 != null; + /* skip */ } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result index 8a3a38cd14..fee9a7cdba 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result @@ -1,73 +1,73 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:54: JML invariant is false on leaving method project.Entrytypes.T2.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:60: JML invariant is false on leaving method project.Entrytypes.T2.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:54: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:60: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:45: JML invariant is false on leaving method project.Entrytypes.T1.get_t2() (for result type) @@ -79,22 +79,22 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -Entry.java:65: JML invariant is false on entering method project.Entrytypes.T2.get_t3() from project.Entry.useNotOk() +Entry.java:70: JML invariant is false on entering method project.Entrytypes.T2.get_t3() from project.Entry.useNotOk() project.Entrytypes.T3 stateDes_11 = stateDes_10.get_t3(); ^ -Entry.java:65: +Entry.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:45: JML invariant is false on leaving method project.Entrytypes.T2.get_t3() diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java index 55fb4ae782..5e910be993 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.T2 get_t2() { - return t2; + project.Entrytypes.T2 ret_3 = t2; + + //@ assert ret_3 != null; + return ret_3; } public void set_t2(final project.Entrytypes.T2 _t2) { + //@ assert _t2 != null; t2 = _t2; + + //@ assert t2 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java index 7ff7de0edd..b7b77e1615 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.T3 get_t3() { - return t3; + project.Entrytypes.T3 ret_4 = t3; + + //@ assert ret_4 != null; + return ret_4; } public void set_t3(final project.Entrytypes.T3 _t3) { + //@ assert _t3 != null; t3 = _t3; + + //@ assert t3 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java index e16f3eb5ae..810c159928 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public project.Entrytypes.T4 get_t4() { - return t4; + project.Entrytypes.T4 ret_5 = t4; + + //@ assert ret_5 != null; + return ret_5; } public void set_t4(final project.Entrytypes.T4 _t4) { + //@ assert _t4 != null; t4 = _t4; + + //@ assert t4 != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java index 090dd53f0c..aced32dcd4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_6 = x; + + //@ assert ret_6 != null; + return ret_6; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java index 9976a5215c..b7e610eacb 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public VDMMap get_m() { - return m; + VDMMap ret_3 = m; + + //@ assert ret_3 != null; + return ret_3; } public void set_m(final VDMMap _m) { + //@ assert _m != null; m = _m; + + //@ assert m != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java index 492999808a..d2a70a3d4f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java @@ -42,11 +42,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_4 = x; + + //@ assert ret_4 != null; + return ret_4; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java index 65de588374..599dc80584 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java @@ -18,6 +18,8 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); + //@ assert ignorePattern_1 != null; + /* skip */ } @@ -27,6 +29,8 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); + //@ assert ignorePattern_2 != null; + /* skip */ } @@ -37,18 +41,24 @@ public static Object Run() { public static Number useOk() { project.Entrytypes.A a = new project.Entrytypes.A(MapUtil.map()); + //@ assert a != null; a.set_m(MapUtil.munion(Utils.copy(a.get_m()), MapUtil.map(new Maplet(1L, new project.Entrytypes.B(2L))))); - return 0L; + Number ret_1 = 0L; + + return ret_1; } public static Number useNotOk() { project.Entrytypes.A a = new project.Entrytypes.A(MapUtil.map()); + //@ assert a != null; a.set_m(MapUtil.munion(Utils.copy(a.get_m()), MapUtil.map(new Maplet(1L, new project.Entrytypes.B(1L))))); - return 0L; + Number ret_2 = 0L; + + return ret_2; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result index dd6fd80f50..d4022a002b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:49: JML invariant is false on leaving method project.Entrytypes.A.set_m(org.overture.codegen.runtime.VDMMap) +A.java:52: JML invariant is false on leaving method project.Entrytypes.A.set_m(org.overture.codegen.runtime.VDMMap) public void set_m(final VDMMap _m) { ^ A.java:13: Associated declaration diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java index 60ef4f1fa0..3d9237a9ea 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java @@ -22,17 +22,28 @@ public static void op1() { //@ assert inv_Entry_PT(p) && (p == null || inv_Entry_PossiblyOne(p) || inv_Entry_True(p)); p = true; //@ assert inv_Entry_PT(p) && (p == null || inv_Entry_PossiblyOne(p) || inv_Entry_True(p)); + + //@ assert St != null; St.set_x(null); + + //@ assert St != null; St.set_x(1L); + + //@ assert St != null; St.set_x(true); + IO.println("Breaking named type invariant (assigning record field)"); + //@ assert St != null; St.set_x(false); } public static void op2() { Object p1 = null; //@ assert inv_Entry_PT(p1) && (p1 == null || inv_Entry_PossiblyOne(p1) || inv_Entry_True(p1)); + + //@ assert St != null; St.set_x(true); + IO.println("Breaking named type invariant (assigning local variable)"); p1 = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result index 8862ccc7bf..a92a51a39d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result @@ -6,6 +6,6 @@ St.java:58: JML assertion is false //@ assert project.Entry.invChecksOn ==> (inv_Entry_PT(x) && (x == null || inv_Entry_PossiblyOne(x) || inv_Entry_True(x))); ^ "Breaking named type invariant (assigning local variable)" -Entry.java:39: JML assertion is false +Entry.java:50: JML assertion is false //@ assert inv_Entry_PT(p1) && (p1 == null || inv_Entry_PossiblyOne(p1) || inv_Entry_True(p1)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java index fe20075525..ab879a975f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java @@ -43,6 +43,8 @@ public static Object Run() { public static Number op(final Number a, final Number b, final Number c) { //@ assert inv_Entry_Even(a); + //@ assert b != null; + //@ assert inv_Entry_Even(c); Number ret_1 = b.longValue() * (a.longValue() + c.longValue()); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result index 24db59f16b..3ea6b57db9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for method parameter" -Entry.java:46: JML assertion is false +Entry.java:48: JML assertion is false //@ assert inv_Entry_Even(c); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java index d0617c8ae5..dd63b8f904 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java @@ -18,8 +18,9 @@ private Entry() { public static Object Run() { Number ignorePattern_1 = opRet(1L); + //@ assert ignorePattern_1 != null; Number ignorePattern_2 = f(3L); - + //@ assert ignorePattern_2 != null; { opVoid(); IO.println("Before breaking post condition"); @@ -27,6 +28,8 @@ public static Object Run() { { Number ignorePattern_3 = opRet(4L); + //@ assert ignorePattern_3 != null; + /* skip */ } @@ -38,35 +41,62 @@ public static Object Run() { //@ ensures post_opVoid(\old(St.copy()),St); public static void opVoid() { + //@ assert St != null; St.set_x(St.get_x().longValue() + 1L); } //@ ensures post_opRet(a,\result,\old(St.copy()),St); public static Number opRet(final Number a) { + //@ assert a != null; + + //@ assert St != null; St.set_x(St.get_x().longValue() + 1L); - return St.get_x(); + Number ret_1 = St.get_x(); + + //@ assert ret_1 != null; + return ret_1; } //@ ensures post_f(a,\result); /*@ pure @*/ public static Number f(final Number a) { + //@ assert a != null; if (Utils.equals(Utils.mod(a.longValue(), 2L), 0L)) { - return a.longValue() + 2L; + Number ret_2 = a.longValue() + 2L; + + //@ assert ret_2 != null; + return ret_2; } else { - return a.longValue() + 1L; + Number ret_3 = a.longValue() + 1L; + + //@ assert ret_3 != null; + return ret_3; } } /*@ pure @*/ public static Boolean post_opVoid(final project.Entrytypes.St _St, final project.Entrytypes.St St) { - return Utils.equals(St.get_x(), _St.get_x().longValue() + 1L); + //@ assert _St != null; + + //@ assert St != null; + Boolean ret_4 = Utils.equals(St.get_x(), _St.get_x().longValue() + 1L); + + //@ assert ret_4 != null; + return ret_4; } /*@ pure @*/ public static Boolean post_opRet(final Number a, final Number RESULT, final project.Entrytypes.St _St, final project.Entrytypes.St St) { + //@ assert a != null; + + //@ assert RESULT != null; + + //@ assert _St != null; + + //@ assert St != null; Boolean andResult_1 = false; if (Utils.equals(St.get_x(), _St.get_x().longValue() + 1L)) { @@ -75,12 +105,21 @@ public static Boolean post_opRet(final Number a, final Number RESULT, } } - return andResult_1; + Boolean ret_5 = andResult_1; + + //@ assert ret_5 != null; + return ret_5; } /*@ pure @*/ public static Boolean post_f(final Number a, final Number RESULT) { - return Utils.equals(Utils.mod(RESULT.longValue(), 2L), 0L); + //@ assert a != null; + + //@ assert RESULT != null; + Boolean ret_6 = Utils.equals(Utils.mod(RESULT.longValue(), 2L), 0L); + + //@ assert ret_6 != null; + return ret_6; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/PostCond.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/PostCond.vdmsl.result index 99b371db25..10ba9330d4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/PostCond.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/PostCond.vdmsl.result @@ -1,8 +1,8 @@ "Before breaking post condition" -Entry.java:45: JML postcondition is false +Entry.java:49: JML postcondition is false public static Number opRet(final Number a) { ^ -Entry.java:44: Associated declaration +Entry.java:48: Associated declaration //@ ensures post_opRet(a,\result,\old(St.copy()),St); ^ "After breaking post condition" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java index 0cfa570bde..6990802b88 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java @@ -42,11 +42,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_7 = x; + + //@ assert ret_7 != null; + return ret_7; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java index 6a6740e730..6718208b15 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java @@ -17,7 +17,7 @@ private Entry() { public static Object Run() { Number ignorePattern_1 = opRet(1L); - + //@ assert ignorePattern_1 != null; { opVoid(2L); IO.println("Before breaking pre condition"); @@ -25,6 +25,8 @@ public static Object Run() { { Number ignorePattern_2 = id(-1L); + //@ assert ignorePattern_2 != null; + /* skip */ } @@ -36,37 +38,66 @@ public static Object Run() { //@ requires pre_opRet(a,St); public static Number opRet(final Number a) { + //@ assert a != null; + + //@ assert St != null; St.set_x(a.longValue() + 1L); - return St.get_x(); + Number ret_1 = St.get_x(); + + //@ assert ret_1 != null; + return ret_1; } //@ requires pre_opVoid(a,St); public static void opVoid(final Number a) { + //@ assert a != null; + + //@ assert St != null; St.set_x(a.longValue() + 1L); } //@ requires pre_id(a); /*@ pure @*/ public static Number id(final Number a) { - return a; + //@ assert a != null; + Number ret_2 = a; + + //@ assert ret_2 != null; + return ret_2; } /*@ pure @*/ public static Boolean pre_opRet(final Number a, final project.Entrytypes.St St) { - return St.get_x().longValue() > 0L; + //@ assert a != null; + + //@ assert St != null; + Boolean ret_3 = St.get_x().longValue() > 0L; + + //@ assert ret_3 != null; + return ret_3; } /*@ pure @*/ public static Boolean pre_opVoid(final Number a, final project.Entrytypes.St St) { - return St.get_x().longValue() > 0L; + //@ assert a != null; + + //@ assert St != null; + Boolean ret_4 = St.get_x().longValue() > 0L; + + //@ assert ret_4 != null; + return ret_4; } /*@ pure @*/ public static Boolean pre_id(final Number a) { - return a.longValue() > 0L; + //@ assert a != null; + Boolean ret_5 = a.longValue() > 0L; + + //@ assert ret_5 != null; + return ret_5; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/PreCond.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/PreCond.vdmsl.result index 53e8f4459a..e5edc4759b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/PreCond.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/PreCond.vdmsl.result @@ -2,7 +2,7 @@ Entry.java:26: JML precondition is false Number ignorePattern_2 = id(-1L); ^ -Entry.java:49: Associated declaration +Entry.java:60: Associated declaration //@ requires pre_id(a); ^ "After breaking pre condition" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java index 0cfa570bde..725e408144 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java @@ -42,11 +42,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_6 = x; + + //@ assert ret_6 != null; + return ret_6; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java index c312082060..11907f92ed 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java @@ -45,20 +45,32 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_1 = x; + + //@ assert ret_1 != null; + return ret_1; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ public Number get_y() { - return y; + Number ret_2 = y; + + //@ assert ret_2 != null; + return ret_2; } public void set_y(final Number _y) { + //@ assert _y != null; y = _y; + + //@ assert y != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java index d3156d7be5..031b91e7c0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_1 = x; + + //@ assert ret_1 != null; + return ret_1; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java index 9950c4a4a8..d0483b9854 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java @@ -31,7 +31,11 @@ public static void opAtomic() { { /* Start of atomic statement */ //@ set invChecksOn = false; + + //@ assert St != null; St.set_x(atomicTmp_1); + + //@ assert St != null; St.set_x(atomicTmp_2); //@ set invChecksOn = true; @@ -40,7 +44,10 @@ public static void opAtomic() { } /* End of atomic statement */} public static void op() { + //@ assert St != null; St.set_x(-10L); + + //@ assert St != null; St.set_x(10L); } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java index d3156d7be5..031b91e7c0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java @@ -43,11 +43,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - return x; + Number ret_1 = x; + + //@ assert ret_1 != null; + return ret_1; } public void set_x(final Number _x) { + //@ assert _x != null; x = _x; + + //@ assert x != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result index 03b1b05694..467006df50 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result @@ -1,11 +1,11 @@ "Before breaking state invariant" -St.java:49: JML invariant is false on leaving method project.Entrytypes.St.set_x(java.lang.Number) +St.java:52: JML invariant is false on leaving method project.Entrytypes.St.set_x(java.lang.Number) public void set_x(final Number _x) { ^ St.java:13: Associated declaration //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); ^ -Entry.java:44: JML invariant is false on entering method project.Entrytypes.St.set_x(java.lang.Number) from project.Entry.op() +Entry.java:51: JML invariant is false on entering method project.Entrytypes.St.set_x(java.lang.Number) from project.Entry.op() St.set_x(10L); ^ St.java:13: Associated declaration From a74b93cb85a881d7c11ca1206add498117330721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 02:55:43 +0200 Subject: [PATCH 057/706] State related tests now expect more assertions to be generated --- .../tests/ModuleStateInvComplexTests.java | 8 ++++---- .../vdm2jml/tests/ModuleStateInvTests.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java index 72ff950359..74e2126777 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java @@ -16,27 +16,27 @@ public static void init() throws AnalysisException public void seqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("seqField", Update.SET_CALL, 1); + ModuleStateInvTests.checkAssertion("seqField", Update.SET_CALL, 2); } @Test public void mapField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("mapField", Update.SET_CALL, 1); + ModuleStateInvTests.checkAssertion("mapField", Update.SET_CALL, 2); } @Test public void fieldSeqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("fieldSeqField", Update.SET_CALL, 2); + ModuleStateInvTests.checkAssertion("fieldSeqField", Update.SET_CALL, 3); } @Test public void seqSeqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("seqSeqField", Update.SET_CALL, 1); + ModuleStateInvTests.checkAssertion("seqSeqField", Update.SET_CALL, 2); } } diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java index a6156ba90d..bd91ef81da 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java @@ -81,7 +81,7 @@ public static void checkAssertion(String methodName, Update update, String assertStr = metaData.get(0).value; Assert.assertTrue("Got unexpected assertion in method '" - + methodName + "'", assertStr.contains(".valid()")); + + methodName + "'", assertStr.contains(".valid()") || assertStr.contains("!= null")); } } else { @@ -103,48 +103,48 @@ public void updateEntireStateAtomic() { // No need to assert since the violation will be picked up by the // atomicTmp var assignment - checkAssertion("atomicAssignSt", Update.ASSIGN, 0); + checkAssertion("atomicAssignSt", Update.ASSIGN, 1); } @Test public void updateField() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("assignX", Update.SET_CALL, 0); + checkAssertion("assignX", Update.SET_CALL, 1); } @Test public void updateFieldAtomic() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("atomicAssignX", Update.SET_CALL, 1); + checkAssertion("atomicAssignX", Update.SET_CALL, 3); } @Test public void updateSeqElem() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("assignS", Update.MAP_SEQ_UPDATE, 1); + checkAssertion("assignS", Update.MAP_SEQ_UPDATE, 2); } @Test public void updateSeqElemAtomic() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("atomicAssignS", Update.MAP_SEQ_UPDATE, 1); + checkAssertion("atomicAssignS", Update.MAP_SEQ_UPDATE, 2); } @Test public void updateMapRng() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("assignM", Update.MAP_SEQ_UPDATE, 1); + checkAssertion("assignM", Update.MAP_SEQ_UPDATE, 2); } @Test public void updateMapRngAtomic() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("atomicAssignM", Update.MAP_SEQ_UPDATE, 1); + checkAssertion("atomicAssignM", Update.MAP_SEQ_UPDATE, 2); } } From ca7361fb65ade77de2a2af949ce08a0fbda8143b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 02:57:21 +0200 Subject: [PATCH 058/706] Simple analysis which checks, statically, if an expression is a value --- .../codegen/vdm2jml/IsValChecker.java | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IsValChecker.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IsValChecker.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IsValChecker.java new file mode 100644 index 0000000000..9c26415165 --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IsValChecker.java @@ -0,0 +1,84 @@ +package org.overture.codegen.vdm2jml; + +import org.overture.codegen.cgast.INode; +import org.overture.codegen.cgast.analysis.AnalysisException; +import org.overture.codegen.cgast.analysis.AnswerAdaptor; +import org.overture.codegen.cgast.expressions.AMinusUnaryExpCG; +import org.overture.codegen.cgast.expressions.ANewExpCG; +import org.overture.codegen.cgast.expressions.APlusUnaryExpCG; +import org.overture.codegen.cgast.expressions.SLiteralExpCG; +import org.overture.codegen.cgast.expressions.SNumericBinaryExpCG; + +public class IsValChecker extends AnswerAdaptor +{ + @Override + public Boolean defaultINode(INode node) throws AnalysisException + { + // Return false for all other cases + return false; + } + + @Override + public Boolean defaultSLiteralExpCG(SLiteralExpCG node) throws AnalysisException + { + return true; + } + + @Override + public Boolean caseANewExpCG(ANewExpCG node) throws AnalysisException + { + return true; + } + + @Override + public Boolean defaultSNumericBinaryExpCG(SNumericBinaryExpCG node) throws AnalysisException + { + if(node.getLeft() == null || node.getRight() == null) + { + return false; + } + + return node.getLeft().apply(this) && node.getRight().apply(this); + } + + @Override + public Boolean caseAMinusUnaryExpCG(AMinusUnaryExpCG node) throws AnalysisException + { + if(node.getExp() == null) + { + return false; + } + else + { + return node.getExp().apply(this); + } + } + + @Override + public Boolean caseAPlusUnaryExpCG(APlusUnaryExpCG node) throws AnalysisException + { + if(node.getExp() == null) + { + return false; + } + else + { + return node.getExp().apply(this); + } + } + + // Do not expect to hit the cases below: + + @Override + public Boolean createNewReturnValue(INode node) throws AnalysisException + { + return false; + } + + @Override + public Boolean createNewReturnValue(Object node) throws AnalysisException + { + return false; + } + +} From 5dd957701ab456601ae62dad43587b7b87f8eeab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 02:58:14 +0200 Subject: [PATCH 059/706] Update 'RecClassInfo' to include the record classes --- .../overture/codegen/vdm2jml/JmlGenUtil.java | 2 ++ .../codegen/vdm2jml/RecClassInfo.java | 32 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java index 2ac57388a8..592a1f4286 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java @@ -244,6 +244,8 @@ public List> makeRecsOuterClasses(List> ast, Rec for (ARecordDeclCG recDecl : recDecls) { ADefaultClassDeclCG recClass = new ADefaultClassDeclCG(); + + recInfo.registerRecClass(recClass); recClass.setMetaData(recDecl.getMetaData()); recClass.setAbstract(false); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java index 5fd110293a..a05fde9320 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java @@ -1,19 +1,24 @@ package org.overture.codegen.vdm2jml; import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; import java.util.Set; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.SDeclCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; public class RecClassInfo { + private List recClasses; private Set members; public RecClassInfo() { + this.recClasses = new LinkedList<>(); this.members = new HashSet(); } @@ -62,7 +67,7 @@ public boolean isRecField(AFieldDeclCG field) { return contains(field); } - + public boolean inAccessor(INode node) { AMethodDeclCG anc = node.getAncestor(AMethodDeclCG.class); @@ -74,4 +79,29 @@ public boolean inAccessor(INode node) return contains(anc); } + + public boolean inRec(INode node) + { + ADefaultClassDeclCG clazz = node.getAncestor(ADefaultClassDeclCG.class); + + if(clazz == null) + { + return false; + } + + for(ADefaultClassDeclCG r : recClasses) + { + if(clazz == r) + { + return true; + } + } + + return false; + } + + public void registerRecClass(ADefaultClassDeclCG recClass) + { + recClasses.add(recClass); + } } From 717f8b22b39cfb6147ddc135b8992f79ef1f1bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 03:04:35 +0200 Subject: [PATCH 060/706] Inject JML assertions to guard against null values for types that are not optional --- .../codegen/vdm2jml/NamedTypeInvHandler.java | 225 ++++++++++++++---- .../codegen/vdm2jml/NamedTypeInvUtil.java | 10 + 2 files changed, 188 insertions(+), 47 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java index 1dc8208c5a..fe043f6a08 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java @@ -7,12 +7,15 @@ import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; +import org.overture.codegen.cgast.analysis.intf.IAnswer; import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; +import org.overture.codegen.cgast.expressions.ANewExpCG; +import org.overture.codegen.cgast.expressions.SLiteralExpCG; import org.overture.codegen.cgast.expressions.SVarExpCG; import org.overture.codegen.cgast.patterns.AIdentifierPatternCG; import org.overture.codegen.cgast.statements.AAssignToExpStmCG; @@ -21,8 +24,10 @@ import org.overture.codegen.cgast.statements.AMapSeqUpdateStmCG; import org.overture.codegen.cgast.statements.AMetaStmCG; import org.overture.codegen.cgast.statements.AReturnStmCG; +import org.overture.codegen.ir.IRGeneratedTag; import org.overture.codegen.ir.IRInfo; import org.overture.codegen.logging.Logger; +import org.overture.codegen.runtime.Utils; import org.overture.codegen.trans.assistants.TransAssistantCG; public class NamedTypeInvHandler implements IAssert @@ -57,6 +62,8 @@ public void handleClass(ADefaultClassDeclCG node) throws AnalysisException public void handleField(AFieldDeclCG node) { + //TODO: No guarding against null! + /** * Values and record fields will be handled by this handler (not the state component field since its type is a * record type) Example: val : char | Even = 5; @@ -145,7 +152,7 @@ public void handleReturn(AReturnStmCG node) throws AnalysisException List invTypes = util.findNamedInvTypes(returnType); - if (invTypes.isEmpty()) + if (invTypes.isEmpty() && !varMayBeNull(returnType)) { return; } @@ -193,7 +200,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException continue; } - SVarExpCG var = getJmlGen().getJavaGen().getInfo().getExpAssistant().consIdVar(varNameStr, param.getType().clone()); + SVarExpCG var = getInfo().getExpAssistant().consIdVar(varNameStr, param.getType().clone()); /** * Upon entering a record setter it is necessary to check if invariants checks are enabled before @@ -202,6 +209,15 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException AMetaStmCG as = util.consAssertStm(invTypes, encClassName, var, node, invTrans.getRecInfo()); replBody.getStatements().add(as); } + else + { + if(varMayBeNull(param.getType())) + { + String varNameStr = invTrans.getJmlGen().getUtil().getName(param.getPattern()); + AMetaStmCG as = util.assertNotNull(varNameStr); + replBody.getStatements().add(as); + } + } } SStmCG body = node.getBody(); @@ -216,8 +232,17 @@ public AMetaStmCG handleMapSeq(AMapSeqUpdateStmCG node) SExpCG col = node.getCol(); - List invTypes = util.findNamedInvTypes(col.getType()); - + if(!(col instanceof SVarExpCG)) + { + Logger.getLog().printErrorln("Expected collection to be a variable expression at this point. Got: " + + col + " in '" + this.getClass().getSimpleName() + + "'"); + } + + SVarExpCG var = ((SVarExpCG) col); + + List invTypes = util.findNamedInvTypes(var.getType()); + if (!invTypes.isEmpty()) { ADefaultClassDeclCG enclosingClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); @@ -232,12 +257,24 @@ public AMetaStmCG handleMapSeq(AMapSeqUpdateStmCG node) /** * Updates to fields in record setters need to check if invariants checks are enabled */ - return util.consAssertStm(invTypes, enclosingClass.getName(), ((SVarExpCG) col), node, invTrans.getRecInfo()); - } else + return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, invTrans.getRecInfo()); + } + } + else + { + if(varMayBeNull(var.getType())) { - Logger.getLog().printErrorln("Expected collection to be a variable expression at this point. Got: " - + col + " in '" + this.getClass().getSimpleName() - + "'"); + // The best we can do is to assert that the map/seq subject to modification is + // not null although we eventually get the null pointer exception, e.g. + // + // //@ azzert m != null + // Utils.mapSeqUpdate(m,1L,1L); + AMetaStmCG assertNotNull = util.assertNotNull(var.getName()); + + ABlockStmCG replStm = new ABlockStmCG(); + getTransAssist().replaceNodeWith(node, replStm); + replStm.getStatements().add(assertNotNull); + replStm.getStatements().add(node); } } @@ -252,32 +289,48 @@ public AMetaStmCG handleVarDecl(AVarDeclCG node) List invTypes = util.findNamedInvTypes(node.getType()); - if (invTypes.isEmpty()) + if (!invTypes.isEmpty()) { - return null; - } + String name = invTrans.getJmlGen().getUtil().getName(node.getPattern()); - String name = invTrans.getJmlGen().getUtil().getName(node.getPattern()); + if (name == null) + { + return null; + } - if (name == null) - { - return null; - } + ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); - ADefaultClassDeclCG enclosingClass = node.getAncestor(ADefaultClassDeclCG.class); + if (enclosingClass == null) + { + return null; + } - if (enclosingClass == null) - { - return null; + AIdentifierVarExpCG var = getJmlGen().getJavaGen().getInfo().getExpAssistant().consIdVar(name, node.getType().clone()); + + /** + * We do not really need to check if invariant checks are enabled because local variable declarations are + * not expected to be found inside record accessors + */ + return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, invTrans.getRecInfo()); } - - AIdentifierVarExpCG var = getJmlGen().getJavaGen().getInfo().getExpAssistant().consIdVar(name, node.getType().clone()); + else + { + if(varMayBeNull(node.getType()) && rightHandSideMayBeNull(node.getExp())) + { + String name = invTrans.getJmlGen().getUtil().getName(node.getPattern()); - /** - * We do not really need to check if invariant checks are enabled because local variable declarations are not - * expected to be found inside record accessors - */ - return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, invTrans.getRecInfo()); + if (name == null) + { + return null; + } + + return util.assertNotNull(name); + } + else + { + return null; + } + } } public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) @@ -308,6 +361,25 @@ public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) */ return util.consAssertStm(invTypes, encClass.getName(), recObjVar, node, invTrans.getRecInfo()); } + else + { + if(varMayBeNull(recObj.getType())) + { + // The best we can do is to assert that the record subject to modification is + // not null although we eventually get the null pointer exception, e.g. + // + // //@ azzert rec != null + // rec.set_x(5); + AMetaStmCG assertNotNull = util.assertNotNull(recObjVar.getName()); + + ABlockStmCG replStm = new ABlockStmCG(); + getTransAssist().replaceNodeWith(node, replStm); + replStm.getStatements().add(assertNotNull); + replStm.getStatements().add(node); + + return null; + } + } } else @@ -344,32 +416,36 @@ public void handleAssign(AAssignToExpStmCG node) return; } + SVarExpCG var = (SVarExpCG) target; + List invTypes = util.findNamedInvTypes(node.getTarget().getType()); - if (invTypes.isEmpty()) + if (!invTypes.isEmpty()) { - return; + ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + + if (encClass == null) + { + return; + } + + /** + * Since assignments can occur inside record setters in the context of an atomic statement block we need to + * check if invariant checks are enabled + */ + AMetaStmCG assertStm = util.consAssertStm(invTypes, encClass.getName(), var, node, invTrans.getRecInfo()); + addAssert(node, assertStm); } - - ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); - - if (encClass == null) + else { - return; + if(varMayBeNull(node.getTarget().getType()) && rightHandSideMayBeNull(node.getExp())) + { + AMetaStmCG assertStm = util.assertNotNull(var.getName()); + addAssert(node, assertStm); + } } - - /** - * Since assignments can occur inside record setters in the context of an atomic statement block we need to - * check if invariant checks are enabled - */ - AMetaStmCG assertStm = util.consAssertStm(invTypes, encClass.getName(), ((SVarExpCG) target), node, invTrans.getRecInfo()); - ABlockStmCG replStm = new ABlockStmCG(); - getJmlGen().getJavaGen().getTransAssistant().replaceNodeWith(node, replStm); - replStm.getStatements().add(node); - replStm.getStatements().add(assertStm); - } - + public ABlockStmCG getEncBlockStm(AVarDeclCG varDecl) { if (varDecl.parent() instanceof ABlockStmCG) @@ -444,4 +520,59 @@ public AMetaStmCG consAssert(AIdentifierVarExpCG var) */ return util.consAssertStm(invTypes, encClass.getName(), var, var, invTrans.getRecInfo()); } + + public boolean rightHandSideMayBeNull(SExpCG exp) + { + IsValChecker checker = new IsValChecker(); + + try + { + return !exp.apply(checker); + } catch (AnalysisException e) + { + e.printStackTrace(); + return false; + } + } + + private boolean varMayBeNull(STypeCG type) + { + if(inModuleToStringMethod(type)) + { + return false; + } + + // Some of the record methods inherited from object use native java type that can never be null + if(invTrans.getRecInfo().inRec(type) && !invTrans.getRecInfo().inAccessor(type)) + { + return false; + } + + return !getInfo().getTypeAssistant().allowsNull(type); + } + + private boolean inModuleToStringMethod(STypeCG type) + { + AMethodDeclCG m = type.getAncestor(AMethodDeclCG.class); + + if(m == null) + { + return false; + } + + if(m.getTag() instanceof IRGeneratedTag && m.getName().equals("toString")) + { + return true; + } + + return false; + } + + private void addAssert(AAssignToExpStmCG node, AMetaStmCG assertStm) + { + ABlockStmCG replStm = new ABlockStmCG(); + getJmlGen().getJavaGen().getTransAssistant().replaceNodeWith(node, replStm); + replStm.getStatements().add(node); + replStm.getStatements().add(assertStm); + } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java index e8a5376277..92becdbed7 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java @@ -177,6 +177,16 @@ public AMetaStmCG consAssertStm(List invTypes, return assertStm; } + + public AMetaStmCG assertNotNull(String varName) + { + AMetaStmCG assertStm = new AMetaStmCG(); + List assertMetaData = handler.getJmlGen().getAnnotator().consMetaData("//@ assert " + varName + " != null;"); + handler.getJmlGen().getAnnotator().appendMetaData(assertStm, assertMetaData); + + return assertStm; + } + public List findNamedInvTypes(STypeCG type) { From 8a1defba534b49139decd356ec0a2a781ce45e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 12:46:51 +0200 Subject: [PATCH 061/706] Set up test for checking of optional types --- .../vdm2jml/tests/OptionalTypeExecTests.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OptionalTypeExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OptionalTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OptionalTypeExecTests.java new file mode 100644 index 0000000000..c9f3d03a35 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OptionalTypeExecTests.java @@ -0,0 +1,33 @@ +package org.overture.vdm2jml.tests; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; + +@RunWith(Parameterized.class) +public class OptionalTypeExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "optionaltype"; + + public static final String PROPERTY_ID = "optionaltype"; + + public OptionalTypeExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From c7685ae98ab6aeb0e80579c66f84898f03879a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 12:48:27 +0200 Subject: [PATCH 062/706] Add first test to check that null pointers get reported for non-optional types --- .../OpParamQuoteTypeViolation.vdmsl | 29 +++++++++++++++++++ .../OpParamQuoteTypeViolation.vdmsl.result | 7 +++++ 2 files changed, 36 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl new file mode 100644 index 0000000000..ebb4f0b343 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl @@ -0,0 +1,29 @@ +module Entry + +imports from IO all +exports all +definitions + +operations + +Run : () ==> ? +Run () == +let aOpt : [] = nil, + a : = +in +( + IO`println("Before passing LEGAL value"); + op(a); + IO`println("After passing LEGAL value"); + + IO`println("Before passing ILLEGAL value"); + op(aOpt); + IO`println("After passing ILLEGAL value"); + + return true; +); + +op : ==> () +op (-) == skip; + +end Entry diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result new file mode 100644 index 0000000000..2fa5ae1696 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result @@ -0,0 +1,7 @@ +"Before passing LEGAL value" +"After passing LEGAL value" +"Before passing ILLEGAL value" +Entry.java:33: JML assertion is false + //@ assert ignorePattern_1 != null; + ^ +"After passing ILLEGAL value" \ No newline at end of file From 5d40438386b8091f570993916a8b336943dee13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 12:50:40 +0200 Subject: [PATCH 063/706] Add support for intercepting the production of quote classes --- .../vdm2java/IJavaQouteEventCoordinator.java | 7 +++ .../vdm2java/IJavaQuoteEventObserver.java | 10 ++++ .../codegen/vdm2java/JavaCodeGen.java | 49 ++++++++++++++++--- .../codegen/ir/IREventCoordinator.java | 4 +- 4 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/IJavaQouteEventCoordinator.java create mode 100644 core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/IJavaQuoteEventObserver.java diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/IJavaQouteEventCoordinator.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/IJavaQouteEventCoordinator.java new file mode 100644 index 0000000000..e3fcf78529 --- /dev/null +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/IJavaQouteEventCoordinator.java @@ -0,0 +1,7 @@ +package org.overture.codegen.vdm2java; + +public interface IJavaQouteEventCoordinator +{ + public void registerJavaQuoteObs(IJavaQuoteEventObserver obs); + public void unregisterJavaQuoteObs(IJavaQuoteEventObserver obs); +} diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/IJavaQuoteEventObserver.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/IJavaQuoteEventObserver.java new file mode 100644 index 0000000000..5e7241d4e3 --- /dev/null +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/IJavaQuoteEventObserver.java @@ -0,0 +1,10 @@ +package org.overture.codegen.vdm2java; + +import java.util.List; + +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; + +public interface IJavaQuoteEventObserver +{ + public void quoteClassesProduced(List quoteClasses); +} diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java index 69247d30b9..28a251ff87 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java @@ -84,7 +84,7 @@ import org.overture.codegen.utils.GeneratedModule; import org.overture.config.Settings; -public class JavaCodeGen extends CodeGenBase implements IREventCoordinator +public class JavaCodeGen extends CodeGenBase implements IREventCoordinator, IJavaQouteEventCoordinator { public static final String JAVA_TEMPLATES_ROOT_FOLDER = "JavaTemplates"; @@ -103,6 +103,7 @@ public class JavaCodeGen extends CodeGenBase implements IREventCoordinator private TemplateStructure javaTemplateStructure; private IREventObserver irObserver; + private IJavaQuoteEventObserver quoteObserver; private JavaVarPrefixManager varPrefixManager; @@ -119,6 +120,7 @@ private void init() this.varPrefixManager = new JavaVarPrefixManager(); this.irObserver = null; + this.quoteObserver = null; initVelocity(); this.javaTemplateStructure = new TemplateStructure(JAVA_TEMPLATES_ROOT_FOLDER); @@ -185,14 +187,29 @@ public List generateJavaFromVdmQuotes() JavaQuoteValueCreator quoteValueCreator = new JavaQuoteValueCreator(generator.getIRInfo(), transAssistant); - List modules = new LinkedList(); + List quoteClasses = new LinkedList<>(); for (String quoteNameVdm : quoteValues) { ADefaultClassDeclCG quoteDecl = quoteValueCreator.consQuoteValue(quoteNameVdm + JAVA_QUOTE_NAME_SUFFIX, quoteNameVdm, getJavaSettings().getJavaRootPackage()); - + + quoteClasses.add(quoteDecl); + } + + // Event notification + if(quoteObserver != null) + { + quoteObserver.quoteClassesProduced(quoteClasses); + } + + List modules = new LinkedList(); + for (int i = 0; i < quoteClasses.size(); i++) + { + String quoteNameVdm = quoteValues.get(i); + ADefaultClassDeclCG qc = quoteClasses.get(i); + StringWriter writer = new StringWriter(); - quoteDecl.apply(javaFormat.getMergeVisitor(), writer); + qc.apply(javaFormat.getMergeVisitor(), writer); String code = writer.toString(); if(getJavaSettings().formatCode()) @@ -200,7 +217,7 @@ public List generateJavaFromVdmQuotes() code = JavaCodeGenUtil.formatJavaCode(code); } - modules.add(new GeneratedModule(quoteNameVdm, quoteDecl, code)); + modules.add(new GeneratedModule(quoteNameVdm, qc, code)); } return modules; @@ -823,7 +840,7 @@ else if(node instanceof AModuleModules) } @Override - public void register(IREventObserver obs) + public void registerIrObs(IREventObserver obs) { if(obs != null && irObserver == null) { @@ -832,13 +849,31 @@ public void register(IREventObserver obs) } @Override - public void unregister(IREventObserver obs) + public void unregisterIrObs(IREventObserver obs) { if(obs != null && irObserver == obs) { irObserver = null; } } + + @Override + public void registerJavaQuoteObs(IJavaQuoteEventObserver obs) + { + if(obs != null && quoteObserver == null) + { + quoteObserver = obs; + } + } + + @Override + public void unregisterJavaQuoteObs(IJavaQuoteEventObserver obs) + { + if(obs != null && quoteObserver == obs) + { + quoteObserver = null; + } + } public List> initialIrEvent(List> ast) { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IREventCoordinator.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IREventCoordinator.java index c4e334bc74..82455db4d0 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IREventCoordinator.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IREventCoordinator.java @@ -2,6 +2,6 @@ public interface IREventCoordinator { - public void register(IREventObserver obs); - public void unregister(IREventObserver obs); + public void registerIrObs(IREventObserver obs); + public void unregisterIrObs(IREventObserver obs); } From 940610dadd40af47b1eef98e1076885fd9c68435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 13:26:26 +0200 Subject: [PATCH 064/706] Add generated Java/JML for optional type test --- .../OpParamQuoteTypeViolation/Entry.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java new file mode 100644 index 0000000000..ec54b1eef0 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java @@ -0,0 +1,41 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + project.quotes.AQuote aOpt = null; + + project.quotes.AQuote a = project.quotes.AQuote.getInstance(); + + { + IO.println("Before passing LEGAL value"); + op(a); + IO.println("After passing LEGAL value"); + IO.println("Before passing ILLEGAL value"); + op(aOpt); + IO.println("After passing ILLEGAL value"); + + return true; + } + } + + public static void op(final project.quotes.AQuote ignorePattern_1) { + //@ assert ignorePattern_1 != null; + + /* skip */ + } + + public String toString() { + return "Entry{}"; + } +} From fecbc033a4939bbe25539887fb0f313c7b058f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 13:27:42 +0200 Subject: [PATCH 065/706] Mark quote classes as nullable_by_default --- .../codegen/vdm2jml/JmlAnnotationHelper.java | 5 +++++ .../codegen/vdm2jml/JmlGenerator.java | 20 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlAnnotationHelper.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlAnnotationHelper.java index af67595b7c..3f58c769c7 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlAnnotationHelper.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlAnnotationHelper.java @@ -25,6 +25,11 @@ public JmlAnnotationHelper(JmlGenerator jmlGen) this.jmlGen = jmlGen; } + public void makeNullableByDefault(ADefaultClassDeclCG clazz) + { + clazz.setGlobalMetaData(consMetaData(JmlGenerator.JML_NULLABLE_BY_DEFAULT)); + } + public void makeNamedTypeInvFuncsPublic(ADefaultClassDeclCG clazz) { List nameInvMethods = jmlGen.getUtil().getNamedTypeInvMethods(clazz); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java index 9b7fa153a1..e05e7021b9 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java @@ -32,6 +32,7 @@ import org.overture.codegen.logging.Logger; import org.overture.codegen.trans.AssignStmTrans; import org.overture.codegen.utils.GeneratedData; +import org.overture.codegen.vdm2java.IJavaQuoteEventObserver; import org.overture.codegen.vdm2java.JavaCodeGen; import org.overture.codegen.vdm2java.JavaCodeGenUtil; import org.overture.codegen.vdm2java.JavaSettings; @@ -40,7 +41,7 @@ import de.hunsicker.jalopy.storage.Convention; import de.hunsicker.jalopy.storage.ConventionKeys; -public class JmlGenerator implements IREventObserver +public class JmlGenerator implements IREventObserver, IJavaQuoteEventObserver { public static final String DEFAULT_JAVA_ROOT_PACKAGE = "project"; public static final String GEN_INV_METHOD_PARAM_NAME = "elem"; @@ -158,7 +159,8 @@ public GeneratedData generateJml(List ast) computeNamedTypeInvInfo(ast); - javaGen.register(this); + javaGen.registerIrObs(this); + javaGen.registerJavaQuoteObs(this); return javaGen.generateJavaFromVdmModules(ast); } @@ -198,7 +200,7 @@ public List> finalIRConstructed(List> ast, { // VDM uses the type system to control whether 'nil' is allowed as a value so we'll // just annotate all classes as @nullable_by_default - status.getIrNode().setGlobalMetaData(annotator.consMetaData(JmlGenerator.JML_NULLABLE_BY_DEFAULT)); + annotator.makeNullableByDefault(status.getIrNode()); } // Only extract from 'ast' to not get the record classes @@ -612,4 +614,16 @@ public StateDesInfo getStateDesInfo() { return stateDesInfo; } + + @Override + public void quoteClassesProduced(List quoteClasses) + { + for(ADefaultClassDeclCG qc : quoteClasses) + { + // Code generated quotes are represented as singletons and by default the instance + // field is null. So we'll mark quote classes as nullable_by_default. + //Example from class represented : private static AQuote instance = null; + annotator.makeNullableByDefault(qc); + } + } } From dea11b7cf56d163edbc565adae4497a90110feb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 14:11:16 +0200 Subject: [PATCH 066/706] Add test to exercise handling of optional types for return values --- .../FuncReturnTokenViolation/Entry.java | 65 +++++++++++++++++++ .../FuncReturnTokenViolation.vdmsl | 38 +++++++++++ .../FuncReturnTokenViolation.vdmsl.result | 10 +++ 3 files changed, 113 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java new file mode 100644 index 0000000000..b923f6e159 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java @@ -0,0 +1,65 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before evaluating ok()"); + + { + Token ignorePattern_1 = ok(); + + //@ assert ignorePattern_1 != null; + + /* skip */ + } + + IO.println("After evaluating ok()"); + IO.println("Before evaluating error()"); + + { + Token ignorePattern_2 = err(); + + //@ assert ignorePattern_2 != null; + + /* skip */ + } + + IO.println("After evaluating error()"); + + return true; + } + + /*@ pure @*/ + public static Token ok() { + Token aOpt = new Token(""); + + Token ret_1 = aOpt; + + //@ assert ret_1 != null; + return ret_1; + } + + /*@ pure @*/ + public static Token err() { + Token aOpt = null; + + Token ret_2 = aOpt; + + //@ assert ret_2 != null; + return ret_2; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl new file mode 100644 index 0000000000..8d0a809ee5 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl @@ -0,0 +1,38 @@ +module Entry + +imports from IO all +exports all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before evaluating ok()"); + let - = ok() in skip; + IO`println("After evaluating ok()"); + + IO`println("Before evaluating error()"); + let - = err() in skip; + IO`println("After evaluating error()"); + + return true; +); + +functions + +ok : () -> token +ok () == +let aOpt : [token] = mk_token("") +in + aOpt; + + +err : () -> token +err () == +let aOpt : [token] = nil +in + aOpt; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result new file mode 100644 index 0000000000..516f7b9ab5 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result @@ -0,0 +1,10 @@ +"Before evaluating ok()" +"After evaluating ok()" +"Before evaluating error()" +Entry.java:58: JML assertion is false + //@ assert ret_2 != null; + ^ +Entry.java:32: JML assertion is false + //@ assert ignorePattern_2 != null; + ^ +"After evaluating error()" \ No newline at end of file From 52fb0b4dd084adc7322464438e6397c193183760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 14:17:50 +0200 Subject: [PATCH 067/706] Add test to exercise handling of optional types for assignments --- .../AssignBoolTypeViolation.vdmsl | 29 +++++++++++++++ .../AssignBoolTypeViolation.vdmsl.result | 7 ++++ .../AssignBoolTypeViolation/Entry.java | 37 +++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl new file mode 100644 index 0000000000..b0f530e8e4 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl @@ -0,0 +1,29 @@ +module Entry + +imports from IO all +exports all +definitions + +operations + +Run : () ==> ? +Run () == +( + dcl b : bool := true; + dcl bOpt : [bool] := nil; + + IO`println("Before doing valid assignments"); + bOpt := true; + b := bOpt; + bOpt := nil; + IO`println("After doing valid assignments"); + + IO`println("Before doing illegal assignments"); + b := bOpt; + IO`println("After doing illegal assignments"); + + return true; +); + + +end Entry diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result new file mode 100644 index 0000000000..0847b66076 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result @@ -0,0 +1,7 @@ +"Before doing valid assignments" +"After doing valid assignments" +"Before doing illegal assignments" +Entry.java:28: JML assertion is false + //@ assert b != null; + ^ +"After doing illegal assignments" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java new file mode 100644 index 0000000000..99a4e351cf --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java @@ -0,0 +1,37 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Boolean b = true; + + Boolean bOpt = null; + + IO.println("Before doing valid assignments"); + bOpt = true; + b = bOpt; + //@ assert b != null; + bOpt = null; + IO.println("After doing valid assignments"); + IO.println("Before doing illegal assignments"); + b = bOpt; + //@ assert b != null; + IO.println("After doing illegal assignments"); + + return true; + } + + public String toString() { + return "Entry{}"; + } +} From 21a7beaeead4fa4ac7644783e2574ad71ea771f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 14:27:13 +0200 Subject: [PATCH 068/706] Testing optional type handling for var declarations --- .../VarDeclTypeViolation/Entry.java | 55 +++++++++++++++++++ .../VarDeclTypeViolation.vdmsl | 31 +++++++++++ .../VarDeclTypeViolation.vdmsl.result | 7 +++ 3 files changed, 93 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java new file mode 100644 index 0000000000..1445108f3a --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java @@ -0,0 +1,55 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before VALID initialisation"); + + { + Number bOkay = natOne(); + + //@ assert bOkay != null; + + /* skip */ + } + + IO.println("After VALID initialisation"); + IO.println("Before INVALID initialisation"); + + { + Number bError = natNil(); + + //@ assert bError != null; + + /* skip */ + } + + IO.println("After INVALID initialisation"); + + return true; + } + + /*@ pure @*/ + public static Number natNil() { + return null; + } + + /*@ pure @*/ + public static Number natOne() { + return 1L; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl new file mode 100644 index 0000000000..d5f185bbd6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl @@ -0,0 +1,31 @@ +module Entry + +imports from IO all +exports all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before VALID initialisation"); + (dcl bOkay : nat := natOne(); skip); + IO`println("After VALID initialisation"); + + IO`println("Before INVALID initialisation"); + (dcl bError : nat := natNil(); skip); + IO`println("After INVALID initialisation"); + + return true; +); + +functions + +natNil : () -> [nat] +natNil () == nil; + +natOne : () -> [nat] +natOne () == 1; + +end Entry diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result new file mode 100644 index 0000000000..5e672dddc3 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result @@ -0,0 +1,7 @@ +"Before VALID initialisation" +"After VALID initialisation" +"Before INVALID initialisation" +Entry.java:32: JML assertion is false + //@ assert bError != null; + ^ +"After INVALID initialisation" \ No newline at end of file From e38b504f0f546e825b81d756fac455944d0f447a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 19:25:22 +0200 Subject: [PATCH 069/706] Update the union type transformation to take field declarations into account --- .../codegen/trans/uniontypes/UnionTypeTrans.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java index fe4cd76fa0..8aa04de3e1 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java @@ -35,6 +35,7 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; +import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; @@ -238,6 +239,20 @@ public STypeCG getExpectedOperandType(SNumericBinaryExpCG node) } } + @Override + public void caseAFieldDeclCG(AFieldDeclCG node) throws AnalysisException + { + if (node.getInitial() != null) + { + if (node.getInitial().getType() instanceof AUnionTypeCG) + { + correctTypes(node.getInitial(), node.getType()); + } + + node.getInitial().apply(this); + } + } + @Override public void caseACardUnaryExpCG(ACardUnaryExpCG node) throws AnalysisException From dfb394836cbd706a0f81c0f7c0c15ba2cc04f397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 19:29:00 +0200 Subject: [PATCH 070/706] Document why we don't do checking of optional types for value definitions --- .../codegen/vdm2jml/NamedTypeInvHandler.java | 49 +++++++++++-------- .../codegen/vdm2jml/NamedTypeInvUtil.java | 7 ++- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java index fe043f6a08..11f80a063e 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java @@ -7,15 +7,12 @@ import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.analysis.AnalysisException; -import org.overture.codegen.cgast.analysis.intf.IAnswer; import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.declarations.AVarDeclCG; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; -import org.overture.codegen.cgast.expressions.ANewExpCG; -import org.overture.codegen.cgast.expressions.SLiteralExpCG; import org.overture.codegen.cgast.expressions.SVarExpCG; import org.overture.codegen.cgast.patterns.AIdentifierPatternCG; import org.overture.codegen.cgast.statements.AAssignToExpStmCG; @@ -27,7 +24,6 @@ import org.overture.codegen.ir.IRGeneratedTag; import org.overture.codegen.ir.IRInfo; import org.overture.codegen.logging.Logger; -import org.overture.codegen.runtime.Utils; import org.overture.codegen.trans.assistants.TransAssistantCG; public class NamedTypeInvHandler implements IAssert @@ -62,19 +58,10 @@ public void handleClass(ADefaultClassDeclCG node) throws AnalysisException public void handleField(AFieldDeclCG node) { - //TODO: No guarding against null! - /** * Values and record fields will be handled by this handler (not the state component field since its type is a * record type) Example: val : char | Even = 5; */ - List invTypes = util.findNamedInvTypes(node.getType()); - - if (invTypes.isEmpty()) - { - return; - } - ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) @@ -88,16 +75,36 @@ public void handleField(AFieldDeclCG node) * So at this point it must be a value defined in a module. No need to check if invariant checks are enabled. */ - AIdentifierVarExpCG var = getJmlGen().getJavaGen().getInfo().getExpAssistant().consIdVar(node.getName(), node.getType().clone()); + List invTypes = util.findNamedInvTypes(node.getType()); + + if (!invTypes.isEmpty()) + { + AIdentifierVarExpCG var = getJmlGen().getJavaGen().getInfo().getExpAssistant().consIdVar(node.getName(), node.getType().clone()); + + String inv = util.consJmlCheck(encClass.getName(), JmlGenerator.JML_PUBLIC, JmlGenerator.JML_STATIC_INV_ANNOTATION, false, invTypes, var); + getAnnotator().appendMetaData(node, getAnnotator().consMetaData(inv)); + } + else + { + // Since value definitions can only be initialised with literals there is no + // need to guard against null (see JmlGenerator.initialIRConstructed) +// if(varMayBeNull(node.getType()) && rightHandSideMayBeNull(node.getInitial())) +// { +// getAnnotator().appendMetaData(node, util.consValNotNullInvariant(node.getName())); +// } + } - String inv = util.consJmlCheck(encClass.getName(), JmlGenerator.JML_PUBLIC, JmlGenerator.JML_STATIC_INV_ANNOTATION, false, invTypes, var); - invTrans.getJmlGen().getAnnotator().appendMetaData(node, invTrans.getJmlGen().getAnnotator().consMetaData(inv)); } /** * No need to assert type consistency of record fields since this is handled by the record setter */ } + private JmlAnnotationHelper getAnnotator() + { + return invTrans.getJmlGen().getAnnotator(); + } + public void handleBlock(ABlockStmCG node) throws AnalysisException { if (node.getLocalDefs().size() > 1) @@ -214,7 +221,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException if(varMayBeNull(param.getType())) { String varNameStr = invTrans.getJmlGen().getUtil().getName(param.getPattern()); - AMetaStmCG as = util.assertNotNull(varNameStr); + AMetaStmCG as = util.consVarNotNullAssert(varNameStr); replBody.getStatements().add(as); } } @@ -269,7 +276,7 @@ public AMetaStmCG handleMapSeq(AMapSeqUpdateStmCG node) // // //@ azzert m != null // Utils.mapSeqUpdate(m,1L,1L); - AMetaStmCG assertNotNull = util.assertNotNull(var.getName()); + AMetaStmCG assertNotNull = util.consVarNotNullAssert(var.getName()); ABlockStmCG replStm = new ABlockStmCG(); getTransAssist().replaceNodeWith(node, replStm); @@ -324,7 +331,7 @@ public AMetaStmCG handleVarDecl(AVarDeclCG node) return null; } - return util.assertNotNull(name); + return util.consVarNotNullAssert(name); } else { @@ -370,7 +377,7 @@ public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) // // //@ azzert rec != null // rec.set_x(5); - AMetaStmCG assertNotNull = util.assertNotNull(recObjVar.getName()); + AMetaStmCG assertNotNull = util.consVarNotNullAssert(recObjVar.getName()); ABlockStmCG replStm = new ABlockStmCG(); getTransAssist().replaceNodeWith(node, replStm); @@ -440,7 +447,7 @@ public void handleAssign(AAssignToExpStmCG node) { if(varMayBeNull(node.getTarget().getType()) && rightHandSideMayBeNull(node.getExp())) { - AMetaStmCG assertStm = util.assertNotNull(var.getName()); + AMetaStmCG assertStm = util.consVarNotNullAssert(var.getName()); addAssert(node, assertStm); } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java index 92becdbed7..51fa9c2f87 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java @@ -178,7 +178,7 @@ public AMetaStmCG consAssertStm(List invTypes, return assertStm; } - public AMetaStmCG assertNotNull(String varName) + public AMetaStmCG consVarNotNullAssert(String varName) { AMetaStmCG assertStm = new AMetaStmCG(); List assertMetaData = handler.getJmlGen().getAnnotator().consMetaData("//@ assert " + varName + " != null;"); @@ -187,6 +187,11 @@ public AMetaStmCG assertNotNull(String varName) return assertStm; } +// public List consValNotNullInvariant(String fieldName) +// { +// return handler.getJmlGen().getAnnotator().consMetaData("//@ static invariant " + fieldName + " != null;"); +// } + public List findNamedInvTypes(STypeCG type) { From 2bf261d58b2aebea649fe5139d2b807035412640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 3 Oct 2015 19:32:07 +0200 Subject: [PATCH 071/706] Limit expressions used to initialise value definitions --- .../codegen/vdm2jml/JmlGenerator.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java index e05e7021b9..a5dcdebe50 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java @@ -1,7 +1,9 @@ package org.overture.codegen.vdm2jml; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; +import java.util.Set; import org.overture.ast.analysis.AnalysisException; import org.overture.ast.definitions.SFunctionDefinition; @@ -15,6 +17,7 @@ import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AMethodDeclCG; +import org.overture.codegen.cgast.declarations.AModuleDeclCG; import org.overture.codegen.cgast.declarations.ANamedTypeDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; import org.overture.codegen.cgast.declarations.ATypeDeclCG; @@ -29,6 +32,7 @@ import org.overture.codegen.ir.IRInfo; import org.overture.codegen.ir.IRSettings; import org.overture.codegen.ir.IRStatus; +import org.overture.codegen.ir.IrNodeInfo; import org.overture.codegen.logging.Logger; import org.overture.codegen.trans.AssignStmTrans; import org.overture.codegen.utils.GeneratedData; @@ -169,6 +173,41 @@ public GeneratedData generateJml(List ast) public List> initialIRConstructed( List> ast, IRInfo info) { + List> modules = IRStatus.extract(ast, AModuleDeclCG.class); + + for(IRStatus m : modules) + { + for(SDeclCG d : m.getIrNode().getDecls()) + { + if(d instanceof AFieldDeclCG) + { + AFieldDeclCG f = (AFieldDeclCG) d; + + if(f.getInitial() != null && f.getFinal()) + { + IsValChecker isVal = new IsValChecker(); + try + { + if(!f.getInitial().apply(isVal)) + { + Set wrap = new HashSet<>(); + IrNodeInfo warning = new IrNodeInfo(f, "The JML generator only allows literal-based expressions " + + "to be used to initialise value definitions"); + // By requiring that there is no need to assert that it is not null + wrap.add(warning); + m.addTransformationWarnings(wrap); + } + + } catch (org.overture.codegen.cgast.analysis.AnalysisException e) + { + e.printStackTrace(); + } + + } + } + } + } + return ast; } From 8346d1a05af16dcdd513f386d0c6635ee8fd382f Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 6 Oct 2015 09:44:15 +0200 Subject: [PATCH 072/706] Add readme file for externals folder. Issue: --- externals/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 externals/README.md diff --git a/externals/README.md b/externals/README.md new file mode 100644 index 0000000000..24ed4ef084 --- /dev/null +++ b/externals/README.md @@ -0,0 +1,11 @@ +External Modules +--- +This folder holds external dependencies. They are accessed via GitHub submodules. + +To initialise the submodule (and checkout the relevant files) use `git +submodule update --init`. This should be done: + +* after cloning the repository +* after switching branches that change the submodule commit (`modified: docrepo (new commits)`) + +See https://github.com/overturetool/overture/wiki/Working-With-Examples for more. From 2fc0152b5388a065ae0b0d7b1374d0e7f3e3b903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 7 Oct 2015 08:44:43 +0200 Subject: [PATCH 073/706] Change leaf nodes to use IR types --- .../overture/codegen/vdm2jml/JmlGenUtil.java | 21 +++++---- .../codegen/vdm2jml/JmlGenerator.java | 2 +- .../codegen/vdm2jml/LeafTypeInfo.java | 38 ++-------------- .../vdm2jml/NamedTypeInvDepCalculator.java | 43 ++++++++++++++++--- .../codegen/vdm2jml/NamedTypeInvUtil.java | 29 ++----------- .../vdm2jml/tests/TypeDependencyTests.java | 24 ++++++----- 6 files changed, 71 insertions(+), 86 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java index 592a1f4286..c9c9818162 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java @@ -30,6 +30,7 @@ import org.overture.codegen.cgast.types.AMethodTypeCG; import org.overture.codegen.ir.IRConstants; import org.overture.codegen.ir.IRStatus; +import org.overture.codegen.ir.SourceNode; import org.overture.codegen.ir.VdmNodeInfo; import org.overture.codegen.logging.Logger; import org.overture.codegen.vdm2java.JavaCodeGenUtil; @@ -400,7 +401,7 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMeth { LeafTypeInfo onlyLeafType = leafTypes.get(0); - STypeCG typeCg = onlyLeafType.toIrType(jmlGen.getJavaGen().getInfo()); + STypeCG typeCg = onlyLeafType.getType(); if (typeCg == null) { @@ -411,7 +412,8 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMeth if (typeCond == null) { - status.getUnsupportedInIr().add(new VdmNodeInfo(onlyLeafType.getType(), TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); + SourceNode sourceNode = onlyLeafType.getType().getSourceNode(); + status.getUnsupportedInIr().add(new VdmNodeInfo(sourceNode != null ? sourceNode.getVdmNode() : null, TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); return null; } } else @@ -419,7 +421,7 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMeth // There are two or more leaf types LeafTypeInfo currentLeafType = leafTypes.get(0); - STypeCG typeCg = currentLeafType.toIrType(jmlGen.getJavaGen().getInfo()); + STypeCG typeCg = currentLeafType.getType(); if (typeCg == null) { @@ -430,7 +432,8 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMeth if (typeCond == null) { - status.getUnsupportedInIr().add(new VdmNodeInfo(currentLeafType.getType(), TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); + SourceNode sourceNode = currentLeafType.getType().getSourceNode(); + status.getUnsupportedInIr().add(new VdmNodeInfo(sourceNode != null ? sourceNode.getVdmNode() : null, TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); return null; } @@ -444,7 +447,7 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMeth for (int i = 1; i < leafTypes.size() - 1; i++) { currentLeafType = leafTypes.get(i); - typeCg = currentLeafType.toIrType(jmlGen.getJavaGen().getInfo()); + typeCg = currentLeafType.getType(); if (typeCg == null) { @@ -455,7 +458,8 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMeth if (typeCond == null) { - status.getUnsupportedInIr().add(new VdmNodeInfo(currentLeafType.getType(), TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); + SourceNode sourceNode = currentLeafType.getType().getSourceNode(); + status.getUnsupportedInIr().add(new VdmNodeInfo(sourceNode != null ? sourceNode.getVdmNode() : null, TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); return null; } @@ -469,7 +473,7 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMeth currentLeafType = leafTypes.get(leafTypes.size() - 1); - typeCg = currentLeafType.toIrType(jmlGen.getJavaGen().getInfo()); + typeCg = currentLeafType.getType(); if (typeCg == null) { @@ -480,7 +484,8 @@ public AIfStmCG consDynamicTypeCheck(IRStatus status, AMeth if (typeCond == null) { - status.getUnsupportedInIr().add(new VdmNodeInfo(currentLeafType.getType(), TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); + SourceNode sourceNode = currentLeafType.getType().getSourceNode(); + status.getUnsupportedInIr().add(new VdmNodeInfo(sourceNode != null ? sourceNode.getVdmNode() : null, TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); return null; } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java index a5dcdebe50..7a9005ee88 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java @@ -363,7 +363,7 @@ private void sortAnnotations(List> newAst) private void computeNamedTypeInvInfo(List ast) throws AnalysisException { - NamedTypeInvDepCalculator depCalc = new NamedTypeInvDepCalculator(); + NamedTypeInvDepCalculator depCalc = new NamedTypeInvDepCalculator(this.getJavaGen().getInfo()); for (AModuleModules m : ast) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java index 671cb04f6e..8be72bca47 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java @@ -3,23 +3,19 @@ import java.util.LinkedList; import java.util.List; -import org.overture.ast.analysis.AnalysisException; -import org.overture.ast.types.PType; import org.overture.codegen.cgast.STypeCG; -import org.overture.codegen.ir.IRInfo; -import org.overture.codegen.logging.Logger; public class LeafTypeInfo extends AbstractTypeInfo { - private PType type; + private STypeCG type; - public LeafTypeInfo(PType type, boolean optional) + public LeafTypeInfo(STypeCG type, boolean optional) { super(optional); this.type = type; } - public PType getType() + public STypeCG getType() { return type; } @@ -42,35 +38,7 @@ public String toString() return type.toString(); } } - - public STypeCG toIrType(IRInfo info) - { - STypeCG irType = toIrType(type, info); - - if(irType != null) - { - irType.setOptional(optional); - } - - return irType; - } - - public static STypeCG toIrType(PType type, IRInfo info) - { - try - { - return type.apply(info.getTypeVisitor(), info); - } catch (AnalysisException e) - { - Logger.getLog().printErrorln("Problems encountered while attempting " - + "to construct the IR type from a VDM type: " - + e.getMessage() + " in '" - + LeafTypeInfo.class.getSimpleName() + "'"); - e.printStackTrace(); - } - return null; - } @Override public List getLeafTypesRecursively() diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java index 51b5992b83..56bb615ca9 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java @@ -12,14 +12,19 @@ import org.overture.ast.types.AOptionalType; import org.overture.ast.types.AUnionType; import org.overture.ast.types.PType; +import org.overture.codegen.cgast.STypeCG; +import org.overture.codegen.ir.IRInfo; +import org.overture.codegen.logging.Logger; public class NamedTypeInvDepCalculator extends DepthFirstAnalysisAdaptor { private List typeInfoList; - - public NamedTypeInvDepCalculator() + private IRInfo info; + + public NamedTypeInvDepCalculator(IRInfo info) { super(); + this.info = info; this.typeInfoList = new LinkedList(); } @@ -112,11 +117,11 @@ public void caseANamedInvariantType(ANamedInvariantType node) // Avoid unnecessary construction if (!containsExactly(node)) { - typeInfoList.addAll(create(node, null, new HashSet())); + typeInfoList.addAll(create(info, node, null, new HashSet())); } } - private static List create(PType type, NamedTypeInfo previous, Set visited) + private static List create(IRInfo info, PType type, NamedTypeInfo previous, Set visited) { if(visited.contains(type)) { @@ -149,7 +154,7 @@ private static List create(PType type, NamedTypeInfo previous, Se NamedTypeInfo typeData = new NamedTypeInfo(namedType.getName().getName(), namedType.getName().getModule(), namedType.getInvDef() != null, optional); - typeData.getNamedTypes().addAll(create(namedType.getType(), typeData, visited)); + typeData.getNamedTypes().addAll(create(info, namedType.getType(), typeData, visited)); data.add(typeData); } else if (type instanceof AUnionType) @@ -164,16 +169,40 @@ private static List create(PType type, NamedTypeInfo previous, Se for (PType t : ((AUnionType) type).getTypes()) { - data.addAll(create(t, previous, visited)); + data.addAll(create(info, t, previous, visited)); } } else { if (previous != null) { - previous.getLeafTypes().add(new LeafTypeInfo(type, optional)); + previous.getLeafTypes().add(new LeafTypeInfo(toIrType(type, info), optional)); } } return data; } + + public static STypeCG toIrType(PType type, IRInfo info) + { + try + { + STypeCG irType = type.apply(info.getTypeVisitor(), info); + + if(irType != null) + { + irType.setOptional(false); + } + + return irType; + + } catch (AnalysisException e) + { + Logger.getLog().printErrorln("Problems encountered while attempting " + + "to construct the IR type from a VDM type: " + + e.getMessage() + " in '" + + LeafTypeInfo.class.getSimpleName() + "'"); + e.printStackTrace(); + return null; + } + } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java index 51fa9c2f87..42053de9a3 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java @@ -3,10 +3,7 @@ import java.util.LinkedList; import java.util.List; -import org.overture.ast.types.ARecordInvariantType; -import org.overture.ast.types.PType; import org.overture.ast.util.ClonableString; -import org.overture.ast.util.PTypeSet; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.declarations.ANamedTypeDeclCG; @@ -128,39 +125,21 @@ private void appendRecValidChecks(boolean invChecksGuard, private List getRecTypes( List typeInfoMatches) { - PTypeSet typeSet = new PTypeSet(handler.getJmlGen().getJavaGen().getInfo().getTcFactory()); - + List recTypes = new LinkedList<>(); + for (NamedTypeInfo match : typeInfoMatches) { List leaves = match.getLeafTypesRecursively(); for (LeafTypeInfo leaf : leaves) { - if (leaf.getType() instanceof ARecordInvariantType) + if (leaf.getType() instanceof ARecordTypeCG) { - typeSet.add(leaf.getType()); + recTypes.add((ARecordTypeCG) leaf.getType()); } } } - List recTypes = new LinkedList<>(); - - for (PType type : typeSet) - { - STypeCG irType = LeafTypeInfo.toIrType(type, handler.getJmlGen().getJavaGen().getInfo()); - - if (irType instanceof ARecordTypeCG) - { - recTypes.add((ARecordTypeCG) irType); - } else - { - Logger.getLog().printErrorln("Expected " + type - + " to convert to a " - + ARecordTypeCG.class.getSimpleName() + " in '" - + this.getClass().getSimpleName() + "'"); - } - } - return recTypes; } diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java index e6df896fea..0760b2fd4d 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java @@ -7,9 +7,10 @@ import org.junit.Assert; import org.junit.Test; import org.overture.ast.modules.AModuleModules; -import org.overture.ast.types.ACharBasicType; -import org.overture.ast.types.ANatNumericBasicType; +import org.overture.codegen.cgast.types.ACharBasicTypeCG; +import org.overture.codegen.cgast.types.ANatNumericBasicTypeCG; import org.overture.codegen.utils.GeneralCodeGenUtils; +import org.overture.codegen.vdm2jml.JmlGenerator; import org.overture.codegen.vdm2jml.LeafTypeInfo; import org.overture.codegen.vdm2jml.NamedTypeInfo; import org.overture.codegen.vdm2jml.NamedTypeInvDepCalculator; @@ -47,7 +48,10 @@ public void load(String filename) AModuleModules module = modules.get(0); - NamedTypeInvDepCalculator depCalc = new NamedTypeInvDepCalculator(); + JmlGenerator jmlGen = new JmlGenerator(); + initJmlGen(jmlGen); + + NamedTypeInvDepCalculator depCalc = new NamedTypeInvDepCalculator(jmlGen.getJavaGen().getInfo()); module.apply(depCalc); @@ -154,7 +158,7 @@ public void namedInvTypeNat() assertTotalNoOfNamedInvTypes(1); assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); - assertLeafType(info, ANatNumericBasicType.class, false); + assertLeafType(info, ANatNumericBasicTypeCG.class, false); assertNullNotAllowed(info); assertNoInv(info); } @@ -171,7 +175,7 @@ public void namedInvTypeNatOpt() assertTotalNoOfNamedInvTypes(1); assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); - assertLeafType(info, ANatNumericBasicType.class, true); + assertLeafType(info, ANatNumericBasicTypeCG.class, true); assertNullAllowed(info); assertNoInv(info); } @@ -188,8 +192,8 @@ public void unionOfBasicAndOptBasic() assertTotalNoOfNamedInvTypes(1); assertNamedChildren(info, 0); assertNoOfLeafs(info, 2); - assertLeafType(info, ANatNumericBasicType.class, false); - assertLeafType(info, ACharBasicType.class, true); + assertLeafType(info, ANatNumericBasicTypeCG.class, false); + assertLeafType(info, ACharBasicTypeCG.class, true); assertNullAllowed(info); assertNoInv(info); } @@ -217,7 +221,7 @@ public void unionOfNamedInvTypes() assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); - assertLeafType(info, ANatNumericBasicType.class, false); + assertLeafType(info, ANatNumericBasicTypeCG.class, false); assertNullNotAllowed(info); assertNoInv(info); @@ -226,7 +230,7 @@ public void unionOfNamedInvTypes() assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); - assertLeafType(info, ACharBasicType.class, true); + assertLeafType(info, ACharBasicTypeCG.class, true); assertNullAllowed(info); assertNoInv(info); } @@ -291,7 +295,7 @@ public void recursive() assertTotalNoOfNamedInvTypes(1); assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); - assertLeafType(info, ANatNumericBasicType.class, false); + assertLeafType(info, ANatNumericBasicTypeCG.class, false); } @Test From 676664391720035e45f12c3b99f435d3d11007ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 7 Oct 2015 17:27:52 +0200 Subject: [PATCH 074/706] Add convenience functionality related to generation fo Java quotes --- .../codegen/vdm2java/JavaCodeGen.java | 9 +++--- .../vdm2java/JavaQuoteValueCreator.java | 32 +++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java index 28a251ff87..4ae92bb574 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java @@ -93,7 +93,6 @@ public class JavaCodeGen extends CodeGenBase implements IREventCoordinator, IJav "Utils", "Record", "Long", "Double", "Character", "String", "List", "Set" }; - public static final String JAVA_QUOTE_NAME_SUFFIX = "Quote"; public static final String JAVA_MAIN_CLASS_NAME = "Main"; public static final String JAVA_QUOTES_PACKAGE = "quotes"; @@ -185,13 +184,13 @@ public List generateJavaFromVdmQuotes() javaFormat.init(); - JavaQuoteValueCreator quoteValueCreator = new JavaQuoteValueCreator(generator.getIRInfo(), transAssistant); + JavaQuoteValueCreator creator = new JavaQuoteValueCreator(generator.getIRInfo(), transAssistant); List quoteClasses = new LinkedList<>(); for (String quoteNameVdm : quoteValues) { - ADefaultClassDeclCG quoteDecl = quoteValueCreator.consQuoteValue(quoteNameVdm - + JAVA_QUOTE_NAME_SUFFIX, quoteNameVdm, getJavaSettings().getJavaRootPackage()); + String pack = getJavaSettings().getJavaRootPackage(); + ADefaultClassDeclCG quoteDecl = creator.consQuoteValue(quoteNameVdm, quoteNameVdm, pack); quoteClasses.add(quoteDecl); } @@ -768,7 +767,7 @@ public void genJavaSourceFile(File root, GeneratedModule generatedModule) if (JavaCodeGenUtil.isQuote(generatedModule.getIrNode(), getJavaSettings())) { - javaFileName += JAVA_QUOTE_NAME_SUFFIX; + javaFileName += JavaQuoteValueCreator.JAVA_QUOTE_NAME_SUFFIX; } javaFileName += IJavaConstants.JAVA_FILE_EXTENSION; diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java index 8cc0ae47a8..4eebf39981 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java @@ -27,6 +27,8 @@ public class JavaQuoteValueCreator extends JavaClassCreatorBase { + public static final String JAVA_QUOTE_NAME_SUFFIX = "Quote"; + private static final String GET_INSTANCE_METHOD = "getInstance"; private static final String HASH_CODE_METHOD = "hashCode"; @@ -45,6 +47,7 @@ public JavaQuoteValueCreator(IRInfo info, TransAssistantCG transformationAssista public ADefaultClassDeclCG consQuoteValue(String quoteClassName, String quoteName, String userCodePackage) { + quoteClassName = quoteClassName + JavaQuoteValueCreator.JAVA_QUOTE_NAME_SUFFIX; ADefaultClassDeclCG decl = new ADefaultClassDeclCG(); decl.setAbstract(false); decl.setAccess(IJavaConstants.PUBLIC); @@ -52,15 +55,9 @@ public ADefaultClassDeclCG consQuoteValue(String quoteClassName, String quoteNam decl.setStatic(false); // The package where the quotes are put is userCode.quotes - if(JavaCodeGenUtil.isValidJavaPackage(userCodePackage)) - { - String quotePackage = userCodePackage + "." + JavaCodeGen.JAVA_QUOTES_PACKAGE; - decl.setPackage(quotePackage); - } - else - { - decl.setPackage(JavaCodeGen.JAVA_QUOTES_PACKAGE); - } + String quotePackage = consQuotePackage(userCodePackage); + + decl.setPackage(quotePackage); decl.getFields().add(consHashcodeField()); decl.getFields().add(consInstanceField(quoteClassName)); @@ -73,6 +70,23 @@ public ADefaultClassDeclCG consQuoteValue(String quoteClassName, String quoteNam return decl; } + + public static String consQuotePackage(String userCodePackage) + { + if(JavaCodeGenUtil.isValidJavaPackage(userCodePackage)) + { + return userCodePackage + "." + JavaCodeGen.JAVA_QUOTES_PACKAGE; + } + else + { + return JavaCodeGen.JAVA_QUOTES_PACKAGE; + } + } + + public static String fullyQualifiedQuoteName(String userCodePackage, String vdmValueName) + { + return consQuotePackage(userCodePackage) + "." + vdmValueName; + } private AFieldDeclCG consHashcodeField() { From ecdc346b70298eb332a591ec31f025f813cbb17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 7 Oct 2015 17:32:23 +0200 Subject: [PATCH 075/706] Add method to check if node appears in record constructor --- .../overture/codegen/vdm2jml/RecClassInfo.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java index a05fde9320..0f11116a0f 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java @@ -80,6 +80,23 @@ public boolean inAccessor(INode node) return contains(anc); } + public boolean inRecConstructor(INode node) + { + if(!inRec(node)) + { + return false; + } + + AMethodDeclCG m = node.getAncestor(AMethodDeclCG.class); + + if(m != null) + { + return m.getIsConstructor(); + } + + return false; + } + public boolean inRec(INode node) { ADefaultClassDeclCG clazz = node.getAncestor(ADefaultClassDeclCG.class); From 0daab5e36ae37f5266d21d8e798d531c5df3583e Mon Sep 17 00:00:00 2001 From: Anders Franz Terkelsen Date: Wed, 7 Oct 2015 18:58:52 +0200 Subject: [PATCH 076/706] [maven-release-plugin] prepare for next development iteration --- core/ast/pom.xml | 2 +- core/codegen/codegen-maven-plugin/pom.xml | 2 +- core/codegen/codegen-runtime/pom.xml | 2 +- core/codegen/ir/pom.xml | 2 +- core/codegen/javagen/pom.xml | 2 +- core/codegen/platform/pom.xml | 2 +- core/codegen/pom.xml | 2 +- core/codegen/vdm2jml/pom.xml | 2 +- core/combinatorialtesting/ctruntime/pom.xml | 2 +- core/combinatorialtesting/ctutils/pom.xml | 2 +- core/combinatorialtesting/pom.xml | 2 +- core/commandline/pom.xml | 2 +- core/guibuilder/pom.xml | 2 +- core/interpreter/pom.xml | 2 +- core/modelcheckers/pom.xml | 2 +- core/modelcheckers/probsolver/pom.xml | 2 +- core/modelcheckers/probsolverintegration/pom.xml | 2 +- core/parser/pom.xml | 2 +- core/pog/pom.xml | 2 +- core/pom.xml | 2 +- core/prettyprinting/npp/pom.xml | 2 +- core/prettyprinting/pom.xml | 2 +- core/prettyprinting/prettyprinter/pom.xml | 2 +- core/testframework/pom.xml | 2 +- core/testing/exsupport/pom.xml | 2 +- core/testing/extests/pom.xml | 2 +- core/testing/framework/pom.xml | 2 +- core/testing/pom.xml | 2 +- core/testing/tests/pom.xml | 2 +- core/typechecker/pom.xml | 2 +- externals/pom.xml | 2 +- pom.xml | 4 ++-- 32 files changed, 33 insertions(+), 33 deletions(-) diff --git a/core/ast/pom.xml b/core/ast/pom.xml index 4a4dc3f4bb..b719c8c859 100644 --- a/core/ast/pom.xml +++ b/core/ast/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/codegen/codegen-maven-plugin/pom.xml b/core/codegen/codegen-maven-plugin/pom.xml index 4a3c6006bd..c8d6f9e2ec 100644 --- a/core/codegen/codegen-maven-plugin/pom.xml +++ b/core/codegen/codegen-maven-plugin/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core codegen - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/codegen/codegen-runtime/pom.xml b/core/codegen/codegen-runtime/pom.xml index 3c8739d4f7..94a2448d49 100644 --- a/core/codegen/codegen-runtime/pom.xml +++ b/core/codegen/codegen-runtime/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core codegen - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/codegen/ir/pom.xml b/core/codegen/ir/pom.xml index 258aa91385..1cefd03aaf 100644 --- a/core/codegen/ir/pom.xml +++ b/core/codegen/ir/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core codegen - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/codegen/javagen/pom.xml b/core/codegen/javagen/pom.xml index a8e15ee51e..c41384a52f 100644 --- a/core/codegen/javagen/pom.xml +++ b/core/codegen/javagen/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core codegen - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/codegen/platform/pom.xml b/core/codegen/platform/pom.xml index efd71450e5..a100c6cf39 100644 --- a/core/codegen/platform/pom.xml +++ b/core/codegen/platform/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core codegen - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/codegen/pom.xml b/core/codegen/pom.xml index d6f9b14094..3b0cbe2603 100644 --- a/core/codegen/pom.xml +++ b/core/codegen/pom.xml @@ -5,7 +5,7 @@ core org.overturetool - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/codegen/vdm2jml/pom.xml b/core/codegen/vdm2jml/pom.xml index 5c37e8b525..9664a4fa4c 100644 --- a/core/codegen/vdm2jml/pom.xml +++ b/core/codegen/vdm2jml/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core codegen - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/combinatorialtesting/ctruntime/pom.xml b/core/combinatorialtesting/ctruntime/pom.xml index ce5d3e88a5..522c892660 100644 --- a/core/combinatorialtesting/ctruntime/pom.xml +++ b/core/combinatorialtesting/ctruntime/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core combinatorialtesting - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/combinatorialtesting/ctutils/pom.xml b/core/combinatorialtesting/ctutils/pom.xml index 924a65f43e..616ba72a6b 100644 --- a/core/combinatorialtesting/ctutils/pom.xml +++ b/core/combinatorialtesting/ctutils/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core combinatorialtesting - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/combinatorialtesting/pom.xml b/core/combinatorialtesting/pom.xml index a112b9bb41..8066ccc860 100644 --- a/core/combinatorialtesting/pom.xml +++ b/core/combinatorialtesting/pom.xml @@ -4,7 +4,7 @@ core org.overturetool - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/commandline/pom.xml b/core/commandline/pom.xml index e81dec07c4..c6c8b2c31c 100644 --- a/core/commandline/pom.xml +++ b/core/commandline/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/guibuilder/pom.xml b/core/guibuilder/pom.xml index 47980413b3..7edc06fbf2 100644 --- a/core/guibuilder/pom.xml +++ b/core/guibuilder/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/interpreter/pom.xml b/core/interpreter/pom.xml index 01a9b04aec..7f6f7e719b 100644 --- a/core/interpreter/pom.xml +++ b/core/interpreter/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/modelcheckers/pom.xml b/core/modelcheckers/pom.xml index 54221e91ac..cacdf34f63 100644 --- a/core/modelcheckers/pom.xml +++ b/core/modelcheckers/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/modelcheckers/probsolver/pom.xml b/core/modelcheckers/probsolver/pom.xml index 3d7e72eb07..052409e674 100644 --- a/core/modelcheckers/probsolver/pom.xml +++ b/core/modelcheckers/probsolver/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core modelcheckers - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/modelcheckers/probsolverintegration/pom.xml b/core/modelcheckers/probsolverintegration/pom.xml index 21dc09549a..fba13f14de 100644 --- a/core/modelcheckers/probsolverintegration/pom.xml +++ b/core/modelcheckers/probsolverintegration/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core modelcheckers - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/parser/pom.xml b/core/parser/pom.xml index 2d2ba58039..aaa9f4eb8a 100644 --- a/core/parser/pom.xml +++ b/core/parser/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/pog/pom.xml b/core/pog/pom.xml index 833ff319be..8af8a35a05 100644 --- a/core/pog/pom.xml +++ b/core/pog/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/pom.xml b/core/pom.xml index de337a6c19..6aca29f894 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -4,7 +4,7 @@ org.overturetool root - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/prettyprinting/npp/pom.xml b/core/prettyprinting/npp/pom.xml index fd8e0b0ca3..ce4efcc743 100644 --- a/core/prettyprinting/npp/pom.xml +++ b/core/prettyprinting/npp/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core prettyprinting - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/prettyprinting/pom.xml b/core/prettyprinting/pom.xml index c4d330b22f..d7fd7e5162 100644 --- a/core/prettyprinting/pom.xml +++ b/core/prettyprinting/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/prettyprinting/prettyprinter/pom.xml b/core/prettyprinting/prettyprinter/pom.xml index 69c9ef495b..a048b78d88 100644 --- a/core/prettyprinting/prettyprinter/pom.xml +++ b/core/prettyprinting/prettyprinter/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core prettyprinting - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/testframework/pom.xml b/core/testframework/pom.xml index 42a9554423..24571594d8 100644 --- a/core/testframework/pom.xml +++ b/core/testframework/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/testing/exsupport/pom.xml b/core/testing/exsupport/pom.xml index 8f54fdddd7..62bce4fb8b 100644 --- a/core/testing/exsupport/pom.xml +++ b/core/testing/exsupport/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core testing - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/testing/extests/pom.xml b/core/testing/extests/pom.xml index 26eaa87e24..5aecf9a0e0 100644 --- a/core/testing/extests/pom.xml +++ b/core/testing/extests/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core testing - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/testing/framework/pom.xml b/core/testing/framework/pom.xml index d8a25ede60..0b42ae979a 100644 --- a/core/testing/framework/pom.xml +++ b/core/testing/framework/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core testing - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/testing/pom.xml b/core/testing/pom.xml index 1d3151d4ed..46d29f1b7e 100644 --- a/core/testing/pom.xml +++ b/core/testing/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/testing/tests/pom.xml b/core/testing/tests/pom.xml index 24facd57ac..709bed3996 100644 --- a/core/testing/tests/pom.xml +++ b/core/testing/tests/pom.xml @@ -4,7 +4,7 @@ org.overturetool.core testing - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/core/typechecker/pom.xml b/core/typechecker/pom.xml index 2d3fe98d3f..08a9d76431 100644 --- a/core/typechecker/pom.xml +++ b/core/typechecker/pom.xml @@ -4,7 +4,7 @@ org.overturetool core - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/externals/pom.xml b/externals/pom.xml index ce2a4bf44b..5fef7096ce 100644 --- a/externals/pom.xml +++ b/externals/pom.xml @@ -4,7 +4,7 @@ org.overturetool root - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 0aabd75590..ff4a98cb14 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.overturetool root - 2.3.0 + 2.3.1-SNAPSHOT The Overture Tool Platform root @@ -302,7 +302,7 @@ git@github.com:overturetool/overture.git scm:git:git://github.com/overturetool/overture.git scm:git:git@github.com:overturetool/overture.git - Release/2.3.0 + HEAD From 8d129cca0036d6396bb0262090f541f5c07b5f4a Mon Sep 17 00:00:00 2001 From: Anders Franz Terkelsen Date: Wed, 7 Oct 2015 19:32:30 +0200 Subject: [PATCH 077/706] Bump ide/ to version 2.3.1-SNAPSHOT --- ide/builders/pom.xml | 2 +- ide/builders/vdmj/META-INF/MANIFEST.MF | 2 +- ide/builders/vdmj/pom.xml | 2 +- ide/core/META-INF/MANIFEST.MF | 2 +- ide/core/pom.xml | 2 +- ide/debug/META-INF/MANIFEST.MF | 2 +- ide/debug/pom.xml | 2 +- ide/features/core/feature.xml | 2 +- ide/features/core/pom.xml | 2 +- ide/features/pom.xml | 2 +- ide/features/rcp/feature.xml | 2 +- ide/features/rcp/pom.xml | 2 +- ide/help/META-INF/MANIFEST.MF | 2 +- ide/help/pom.xml | 2 +- ide/parsers/pom.xml | 2 +- ide/parsers/vdmj/META-INF/MANIFEST.MF | 2 +- ide/parsers/vdmj/pom.xml | 2 +- ide/platform/META-INF/MANIFEST.MF | 2 +- ide/platform/pom.xml | 2 +- ide/plugins/codegen/META-INF/MANIFEST.MF | 2 +- ide/plugins/codegen/pom.xml | 2 +- ide/plugins/combinatorialtesting/META-INF/MANIFEST.MF | 2 +- ide/plugins/combinatorialtesting/pom.xml | 2 +- ide/plugins/coverageeditor/META-INF/MANIFEST.MF | 2 +- ide/plugins/coverageeditor/pom.xml | 2 +- ide/plugins/csk/META-INF/MANIFEST.MF | 2 +- ide/plugins/csk/pom.xml | 2 +- ide/plugins/developerutils/META-INF/MANIFEST.MF | 2 +- ide/plugins/developerutils/pom.xml | 2 +- ide/plugins/externaleditor/META-INF/MANIFEST.MF | 2 +- ide/plugins/externaleditor/pom.xml | 2 +- ide/plugins/features/codegen/feature.xml | 2 +- ide/plugins/features/codegen/pom.xml | 2 +- ide/plugins/features/combinatorialtesting/feature.xml | 2 +- ide/plugins/features/combinatorialtesting/pom.xml | 2 +- ide/plugins/features/coverageeditor/feature.xml | 2 +- ide/plugins/features/coverageeditor/pom.xml | 2 +- ide/plugins/features/csk/feature.xml | 2 +- ide/plugins/features/csk/pom.xml | 2 +- ide/plugins/features/developerutils/feature.xml | 2 +- ide/plugins/features/developerutils/pom.xml | 2 +- ide/plugins/features/guibuilder/feature.xml | 2 +- ide/plugins/features/guibuilder/pom.xml | 2 +- ide/plugins/features/latex/feature.xml | 2 +- ide/plugins/features/latex/pom.xml | 2 +- ide/plugins/features/pom.xml | 2 +- ide/plugins/features/poviewer/feature.xml | 2 +- ide/plugins/features/poviewer/pom.xml | 2 +- ide/plugins/features/probruntime/feature.xml | 2 +- ide/plugins/features/probruntime/pom.xml | 2 +- ide/plugins/features/quickinterpreter/feature.xml | 2 +- ide/plugins/features/quickinterpreter/pom.xml | 2 +- ide/plugins/features/rttraceviewer/feature.xml | 2 +- ide/plugins/features/rttraceviewer/pom.xml | 2 +- ide/plugins/features/uml2/feature.xml | 2 +- ide/plugins/features/uml2/pom.xml | 2 +- ide/plugins/guibuilder/META-INF/MANIFEST.MF | 2 +- ide/plugins/guibuilder/pom.xml | 2 +- ide/plugins/latex/META-INF/MANIFEST.MF | 2 +- ide/plugins/latex/pom.xml | 2 +- ide/plugins/pom.xml | 2 +- ide/plugins/poviewer/META-INF/MANIFEST.MF | 2 +- ide/plugins/poviewer/pom.xml | 2 +- ide/plugins/prob-runtime/core/META-INF/MANIFEST.MF | 2 +- ide/plugins/prob-runtime/core/pom.xml | 2 +- ide/plugins/prob-runtime/linux.x86/META-INF/MANIFEST.MF | 2 +- ide/plugins/prob-runtime/linux.x86/pom.xml | 2 +- ide/plugins/prob-runtime/linux.x86_64/META-INF/MANIFEST.MF | 2 +- ide/plugins/prob-runtime/linux.x86_64/pom.xml | 2 +- ide/plugins/prob-runtime/macosx.x86_64/META-INF/MANIFEST.MF | 2 +- ide/plugins/prob-runtime/macosx.x86_64/pom.xml | 2 +- ide/plugins/prob-runtime/pom.xml | 2 +- ide/plugins/prob-runtime/win32.win32/META-INF/MANIFEST.MF | 2 +- ide/plugins/prob-runtime/win32.win32/pom.xml | 2 +- ide/plugins/quickinterpreter/META-INF/MANIFEST.MF | 2 +- ide/plugins/quickinterpreter/pom.xml | 2 +- ide/plugins/rttraceviewer/META-INF/MANIFEST.MF | 2 +- ide/plugins/rttraceviewer/pom.xml | 2 +- ide/plugins/uml2.tests/META-INF/MANIFEST.MF | 2 +- ide/plugins/uml2.tests/pom.xml | 2 +- ide/plugins/uml2/META-INF/MANIFEST.MF | 2 +- ide/plugins/uml2/pom.xml | 2 +- ide/pom.xml | 2 +- ide/product/overture.product | 2 +- ide/product/pom.xml | 2 +- ide/tests/pom.xml | 2 +- ide/tests/ui/META-INF/MANIFEST.MF | 2 +- ide/tests/ui/pom.xml | 2 +- ide/ui/META-INF/MANIFEST.MF | 2 +- ide/ui/pom.xml | 2 +- ide/vdmpp/core/META-INF/MANIFEST.MF | 2 +- ide/vdmpp/core/pom.xml | 2 +- ide/vdmpp/debug/META-INF/MANIFEST.MF | 2 +- ide/vdmpp/debug/pom.xml | 2 +- ide/vdmpp/pom.xml | 2 +- ide/vdmpp/ui/META-INF/MANIFEST.MF | 2 +- ide/vdmpp/ui/pom.xml | 2 +- ide/vdmrt/core/META-INF/MANIFEST.MF | 2 +- ide/vdmrt/core/pom.xml | 2 +- ide/vdmrt/debug/META-INF/MANIFEST.MF | 2 +- ide/vdmrt/debug/pom.xml | 2 +- ide/vdmrt/pom.xml | 2 +- ide/vdmrt/ui/META-INF/MANIFEST.MF | 2 +- ide/vdmrt/ui/pom.xml | 2 +- ide/vdmsl/core/META-INF/MANIFEST.MF | 2 +- ide/vdmsl/core/pom.xml | 2 +- ide/vdmsl/debug/META-INF/MANIFEST.MF | 2 +- ide/vdmsl/debug/pom.xml | 2 +- ide/vdmsl/pom.xml | 2 +- ide/vdmsl/ui/META-INF/MANIFEST.MF | 2 +- ide/vdmsl/ui/pom.xml | 2 +- 111 files changed, 111 insertions(+), 111 deletions(-) diff --git a/ide/builders/pom.xml b/ide/builders/pom.xml index 521f308be2..e1994978a0 100644 --- a/ide/builders/pom.xml +++ b/ide/builders/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/builders/vdmj/META-INF/MANIFEST.MF b/ide/builders/vdmj/META-INF/MANIFEST.MF index 01dcfc7cb7..ee1cb02652 100644 --- a/ide/builders/vdmj/META-INF/MANIFEST.MF +++ b/ide/builders/vdmj/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Eclipse-BundleShape: dir Bundle-Localization: plugin diff --git a/ide/builders/vdmj/pom.xml b/ide/builders/vdmj/pom.xml index 897014e927..f1db5011e9 100644 --- a/ide/builders/vdmj/pom.xml +++ b/ide/builders/vdmj/pom.xml @@ -4,7 +4,7 @@ org.overturetool.ide org.overture.ide.builders - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/core/META-INF/MANIFEST.MF b/ide/core/META-INF/MANIFEST.MF index ca02b55445..90d0cbeaec 100644 --- a/ide/core/META-INF/MANIFEST.MF +++ b/ide/core/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Eclipse-BundleShape: dir Bundle-Localization: plugin diff --git a/ide/core/pom.xml b/ide/core/pom.xml index 0bc6f738f8..91fc3bbe1e 100644 --- a/ide/core/pom.xml +++ b/ide/core/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/debug/META-INF/MANIFEST.MF b/ide/debug/META-INF/MANIFEST.MF index 0ec3762b97..4ea3d8b885 100644 --- a/ide/debug/META-INF/MANIFEST.MF +++ b/ide/debug/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Eclipse-BundleShape: dir Bundle-Localization: plugin diff --git a/ide/debug/pom.xml b/ide/debug/pom.xml index b10f499260..22d19eb358 100644 --- a/ide/debug/pom.xml +++ b/ide/debug/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/features/core/feature.xml b/ide/features/core/feature.xml index 587a0f7fd1..a26330834e 100644 --- a/ide/features/core/feature.xml +++ b/ide/features/core/feature.xml @@ -2,7 +2,7 @@ diff --git a/ide/features/core/pom.xml b/ide/features/core/pom.xml index fb538a21ee..25d4680382 100644 --- a/ide/features/core/pom.xml +++ b/ide/features/core/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/features/pom.xml b/ide/features/pom.xml index 36d4676cfc..666998cac6 100644 --- a/ide/features/pom.xml +++ b/ide/features/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/features/rcp/feature.xml b/ide/features/rcp/feature.xml index a861d6bf61..1197fb152b 100644 --- a/ide/features/rcp/feature.xml +++ b/ide/features/rcp/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/features/rcp/pom.xml b/ide/features/rcp/pom.xml index 009a2d21f2..9513796784 100644 --- a/ide/features/rcp/pom.xml +++ b/ide/features/rcp/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/help/META-INF/MANIFEST.MF b/ide/help/META-INF/MANIFEST.MF index 924c1c9ee0..5bbd675176 100644 --- a/ide/help/META-INF/MANIFEST.MF +++ b/ide/help/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Eclipse-BundleShape: dir Bundle-Localization: plugin diff --git a/ide/help/pom.xml b/ide/help/pom.xml index 3efb1ab7c2..a110df92d2 100644 --- a/ide/help/pom.xml +++ b/ide/help/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/parsers/pom.xml b/ide/parsers/pom.xml index 4b5549e5ce..ea4e7baad3 100644 --- a/ide/parsers/pom.xml +++ b/ide/parsers/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/parsers/vdmj/META-INF/MANIFEST.MF b/ide/parsers/vdmj/META-INF/MANIFEST.MF index b4676b3486..4640e3b87b 100644 --- a/ide/parsers/vdmj/META-INF/MANIFEST.MF +++ b/ide/parsers/vdmj/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.parsers.vdmj diff --git a/ide/parsers/vdmj/pom.xml b/ide/parsers/vdmj/pom.xml index 4ca4236470..0f954f0e2c 100644 --- a/ide/parsers/vdmj/pom.xml +++ b/ide/parsers/vdmj/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.parsers - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/platform/META-INF/MANIFEST.MF b/ide/platform/META-INF/MANIFEST.MF index 0cdcf26ea2..ee8e238f61 100644 --- a/ide/platform/META-INF/MANIFEST.MF +++ b/ide/platform/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: org.overture.ide.platform Bundle-SymbolicName: org.overture.ide.platform;singleton:=true -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui, diff --git a/ide/platform/pom.xml b/ide/platform/pom.xml index 62c758419a..0bf8c9a5a7 100644 --- a/ide/platform/pom.xml +++ b/ide/platform/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/codegen/META-INF/MANIFEST.MF b/ide/plugins/codegen/META-INF/MANIFEST.MF index 00615e91d8..8f3e14dca3 100644 --- a/ide/plugins/codegen/META-INF/MANIFEST.MF +++ b/ide/plugins/codegen/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Name: Code Generator Bundle-ManifestVersion: 2 diff --git a/ide/plugins/codegen/pom.xml b/ide/plugins/codegen/pom.xml index 8efed7f2c3..7c94da7ece 100644 --- a/ide/plugins/codegen/pom.xml +++ b/ide/plugins/codegen/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/combinatorialtesting/META-INF/MANIFEST.MF b/ide/plugins/combinatorialtesting/META-INF/MANIFEST.MF index 2a8341c4dd..cfaa939fdf 100644 --- a/ide/plugins/combinatorialtesting/META-INF/MANIFEST.MF +++ b/ide/plugins/combinatorialtesting/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Eclipse-BundleShape: dir Bundle-Localization: plugin diff --git a/ide/plugins/combinatorialtesting/pom.xml b/ide/plugins/combinatorialtesting/pom.xml index 19a016ca61..3a79a16308 100644 --- a/ide/plugins/combinatorialtesting/pom.xml +++ b/ide/plugins/combinatorialtesting/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/coverageeditor/META-INF/MANIFEST.MF b/ide/plugins/coverageeditor/META-INF/MANIFEST.MF index 18528c2fdc..adb8270ffc 100644 --- a/ide/plugins/coverageeditor/META-INF/MANIFEST.MF +++ b/ide/plugins/coverageeditor/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.plugins.coverageeditor diff --git a/ide/plugins/coverageeditor/pom.xml b/ide/plugins/coverageeditor/pom.xml index 34d022b6b0..e73e877cb0 100644 --- a/ide/plugins/coverageeditor/pom.xml +++ b/ide/plugins/coverageeditor/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/csk/META-INF/MANIFEST.MF b/ide/plugins/csk/META-INF/MANIFEST.MF index 03c98d05c5..5da89e0f24 100644 --- a/ide/plugins/csk/META-INF/MANIFEST.MF +++ b/ide/plugins/csk/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.plugins.csk diff --git a/ide/plugins/csk/pom.xml b/ide/plugins/csk/pom.xml index 432994056f..dbdda4f1b1 100644 --- a/ide/plugins/csk/pom.xml +++ b/ide/plugins/csk/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/developerutils/META-INF/MANIFEST.MF b/ide/plugins/developerutils/META-INF/MANIFEST.MF index 7e434b1b70..88a5820216 100644 --- a/ide/plugins/developerutils/META-INF/MANIFEST.MF +++ b/ide/plugins/developerutils/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: Developer Utilities for Overture diff --git a/ide/plugins/developerutils/pom.xml b/ide/plugins/developerutils/pom.xml index 4ebbdb1b19..6a050940c2 100644 --- a/ide/plugins/developerutils/pom.xml +++ b/ide/plugins/developerutils/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/externaleditor/META-INF/MANIFEST.MF b/ide/plugins/externaleditor/META-INF/MANIFEST.MF index 32e1fb4616..0fea1f11cb 100644 --- a/ide/plugins/externaleditor/META-INF/MANIFEST.MF +++ b/ide/plugins/externaleditor/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.plugins.externaleditor diff --git a/ide/plugins/externaleditor/pom.xml b/ide/plugins/externaleditor/pom.xml index 9fadc80554..e75fdfb75d 100644 --- a/ide/plugins/externaleditor/pom.xml +++ b/ide/plugins/externaleditor/pom.xml @@ -4,7 +4,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/codegen/feature.xml b/ide/plugins/features/codegen/feature.xml index 495ababf32..57350be849 100644 --- a/ide/plugins/features/codegen/feature.xml +++ b/ide/plugins/features/codegen/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/codegen/pom.xml b/ide/plugins/features/codegen/pom.xml index a55f2333a8..006bbd2309 100644 --- a/ide/plugins/features/codegen/pom.xml +++ b/ide/plugins/features/codegen/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/combinatorialtesting/feature.xml b/ide/plugins/features/combinatorialtesting/feature.xml index fd3f4c94cd..4b91572cc2 100644 --- a/ide/plugins/features/combinatorialtesting/feature.xml +++ b/ide/plugins/features/combinatorialtesting/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/combinatorialtesting/pom.xml b/ide/plugins/features/combinatorialtesting/pom.xml index 58a9c8caef..f068753131 100644 --- a/ide/plugins/features/combinatorialtesting/pom.xml +++ b/ide/plugins/features/combinatorialtesting/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/coverageeditor/feature.xml b/ide/plugins/features/coverageeditor/feature.xml index 67f78e7e47..518386626b 100644 --- a/ide/plugins/features/coverageeditor/feature.xml +++ b/ide/plugins/features/coverageeditor/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/coverageeditor/pom.xml b/ide/plugins/features/coverageeditor/pom.xml index f9079b3040..c5d6ade4ed 100644 --- a/ide/plugins/features/coverageeditor/pom.xml +++ b/ide/plugins/features/coverageeditor/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/csk/feature.xml b/ide/plugins/features/csk/feature.xml index 7580569a35..21f23e464b 100644 --- a/ide/plugins/features/csk/feature.xml +++ b/ide/plugins/features/csk/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/csk/pom.xml b/ide/plugins/features/csk/pom.xml index 7588c63f89..62536ed373 100644 --- a/ide/plugins/features/csk/pom.xml +++ b/ide/plugins/features/csk/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/developerutils/feature.xml b/ide/plugins/features/developerutils/feature.xml index 3fe9ccbf8f..88dcf962c0 100644 --- a/ide/plugins/features/developerutils/feature.xml +++ b/ide/plugins/features/developerutils/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/developerutils/pom.xml b/ide/plugins/features/developerutils/pom.xml index 8f0fe6db5c..4b6241d4a6 100644 --- a/ide/plugins/features/developerutils/pom.xml +++ b/ide/plugins/features/developerutils/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/guibuilder/feature.xml b/ide/plugins/features/guibuilder/feature.xml index 14dae089fb..423e59f3e5 100644 --- a/ide/plugins/features/guibuilder/feature.xml +++ b/ide/plugins/features/guibuilder/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/guibuilder/pom.xml b/ide/plugins/features/guibuilder/pom.xml index 6f410344e3..8d55d8b044 100644 --- a/ide/plugins/features/guibuilder/pom.xml +++ b/ide/plugins/features/guibuilder/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/latex/feature.xml b/ide/plugins/features/latex/feature.xml index 70be01b6f7..9d25ab4543 100644 --- a/ide/plugins/features/latex/feature.xml +++ b/ide/plugins/features/latex/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/latex/pom.xml b/ide/plugins/features/latex/pom.xml index 14b99cd4b4..63419bc26a 100644 --- a/ide/plugins/features/latex/pom.xml +++ b/ide/plugins/features/latex/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/pom.xml b/ide/plugins/features/pom.xml index 0ed5eedf60..6c63a13397 100644 --- a/ide/plugins/features/pom.xml +++ b/ide/plugins/features/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/poviewer/feature.xml b/ide/plugins/features/poviewer/feature.xml index a80fc78efd..c5c31c1e57 100644 --- a/ide/plugins/features/poviewer/feature.xml +++ b/ide/plugins/features/poviewer/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/poviewer/pom.xml b/ide/plugins/features/poviewer/pom.xml index 6083d8ef00..d818cb3426 100644 --- a/ide/plugins/features/poviewer/pom.xml +++ b/ide/plugins/features/poviewer/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/probruntime/feature.xml b/ide/plugins/features/probruntime/feature.xml index f9bf2b9411..568f4c5977 100644 --- a/ide/plugins/features/probruntime/feature.xml +++ b/ide/plugins/features/probruntime/feature.xml @@ -2,7 +2,7 @@ diff --git a/ide/plugins/features/probruntime/pom.xml b/ide/plugins/features/probruntime/pom.xml index 1aedc9b154..4ab5b8a367 100644 --- a/ide/plugins/features/probruntime/pom.xml +++ b/ide/plugins/features/probruntime/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/quickinterpreter/feature.xml b/ide/plugins/features/quickinterpreter/feature.xml index 23b1799685..57455af66f 100644 --- a/ide/plugins/features/quickinterpreter/feature.xml +++ b/ide/plugins/features/quickinterpreter/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/quickinterpreter/pom.xml b/ide/plugins/features/quickinterpreter/pom.xml index 6b40c5981e..4d1326174d 100644 --- a/ide/plugins/features/quickinterpreter/pom.xml +++ b/ide/plugins/features/quickinterpreter/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/rttraceviewer/feature.xml b/ide/plugins/features/rttraceviewer/feature.xml index e114132dbb..59d6dee4e5 100644 --- a/ide/plugins/features/rttraceviewer/feature.xml +++ b/ide/plugins/features/rttraceviewer/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/rttraceviewer/pom.xml b/ide/plugins/features/rttraceviewer/pom.xml index 97f62f3799..fe99431c46 100644 --- a/ide/plugins/features/rttraceviewer/pom.xml +++ b/ide/plugins/features/rttraceviewer/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/features/uml2/feature.xml b/ide/plugins/features/uml2/feature.xml index 9e7b2fcee3..1abdd7a444 100644 --- a/ide/plugins/features/uml2/feature.xml +++ b/ide/plugins/features/uml2/feature.xml @@ -2,7 +2,7 @@ + version="2.3.1.qualifier"> %description diff --git a/ide/plugins/features/uml2/pom.xml b/ide/plugins/features/uml2/pom.xml index f8d74fcdb5..af55f33153 100644 --- a/ide/plugins/features/uml2/pom.xml +++ b/ide/plugins/features/uml2/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.features - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/guibuilder/META-INF/MANIFEST.MF b/ide/plugins/guibuilder/META-INF/MANIFEST.MF index c401d010eb..613d74ed7b 100644 --- a/ide/plugins/guibuilder/META-INF/MANIFEST.MF +++ b/ide/plugins/guibuilder/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Eclipse-BundleShape: dir Bundle-Localization: plugin diff --git a/ide/plugins/guibuilder/pom.xml b/ide/plugins/guibuilder/pom.xml index f4ef2d787a..22ff6a09f0 100644 --- a/ide/plugins/guibuilder/pom.xml +++ b/ide/plugins/guibuilder/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/latex/META-INF/MANIFEST.MF b/ide/plugins/latex/META-INF/MANIFEST.MF index 7ad5c28e54..a1e907509c 100644 --- a/ide/plugins/latex/META-INF/MANIFEST.MF +++ b/ide/plugins/latex/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.plugins.latex diff --git a/ide/plugins/latex/pom.xml b/ide/plugins/latex/pom.xml index b041e43e23..4a5419a661 100644 --- a/ide/plugins/latex/pom.xml +++ b/ide/plugins/latex/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/pom.xml b/ide/plugins/pom.xml index 7d8960ff4e..ae52fa9986 100644 --- a/ide/plugins/pom.xml +++ b/ide/plugins/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/poviewer/META-INF/MANIFEST.MF b/ide/plugins/poviewer/META-INF/MANIFEST.MF index 01cfe2cafa..557783f317 100644 --- a/ide/plugins/poviewer/META-INF/MANIFEST.MF +++ b/ide/plugins/poviewer/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Eclipse-BundleShape: dir Bundle-Localization: plugin diff --git a/ide/plugins/poviewer/pom.xml b/ide/plugins/poviewer/pom.xml index e87834f384..f2bdbb4f8b 100644 --- a/ide/plugins/poviewer/pom.xml +++ b/ide/plugins/poviewer/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/prob-runtime/core/META-INF/MANIFEST.MF b/ide/plugins/prob-runtime/core/META-INF/MANIFEST.MF index efcb249a2b..cc5cac3f7b 100644 --- a/ide/plugins/prob-runtime/core/META-INF/MANIFEST.MF +++ b/ide/plugins/prob-runtime/core/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Eclipse-BundleShape: dir Bundle-Name: ProB Runtime diff --git a/ide/plugins/prob-runtime/core/pom.xml b/ide/plugins/prob-runtime/core/pom.xml index 281d547b43..2a8372177b 100644 --- a/ide/plugins/prob-runtime/core/pom.xml +++ b/ide/plugins/prob-runtime/core/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.probruntime - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/prob-runtime/linux.x86/META-INF/MANIFEST.MF b/ide/plugins/prob-runtime/linux.x86/META-INF/MANIFEST.MF index 2b261f02b8..92971efc23 100644 --- a/ide/plugins/prob-runtime/linux.x86/META-INF/MANIFEST.MF +++ b/ide/plugins/prob-runtime/linux.x86/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Eclipse-BundleShape: dir Bundle-ManifestVersion: 2 Bundle-Name: org.overture.ide.plugins.probruntime Bundle-SymbolicName: org.overture.ide.plugins.probruntime.linux.x86;singleton:=true -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Fragment-Host: org.overture.ide.plugins.probruntime.core Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/ide/plugins/prob-runtime/linux.x86/pom.xml b/ide/plugins/prob-runtime/linux.x86/pom.xml index 467fbd2a04..71f1edf2e4 100644 --- a/ide/plugins/prob-runtime/linux.x86/pom.xml +++ b/ide/plugins/prob-runtime/linux.x86/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.probruntime - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/prob-runtime/linux.x86_64/META-INF/MANIFEST.MF b/ide/plugins/prob-runtime/linux.x86_64/META-INF/MANIFEST.MF index e8899bdc5c..8d7d1a5afd 100644 --- a/ide/plugins/prob-runtime/linux.x86_64/META-INF/MANIFEST.MF +++ b/ide/plugins/prob-runtime/linux.x86_64/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Eclipse-BundleShape: dir Bundle-ManifestVersion: 2 Bundle-Name: org.overture.ide.plugins.probruntime Bundle-SymbolicName: org.overture.ide.plugins.probruntime.linux.x86_64;singleton:=true -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Fragment-Host: org.overture.ide.plugins.probruntime.core Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/ide/plugins/prob-runtime/linux.x86_64/pom.xml b/ide/plugins/prob-runtime/linux.x86_64/pom.xml index 674321bcf2..5cda82175c 100644 --- a/ide/plugins/prob-runtime/linux.x86_64/pom.xml +++ b/ide/plugins/prob-runtime/linux.x86_64/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.probruntime - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/prob-runtime/macosx.x86_64/META-INF/MANIFEST.MF b/ide/plugins/prob-runtime/macosx.x86_64/META-INF/MANIFEST.MF index 72bc61a99b..ed8be288cf 100644 --- a/ide/plugins/prob-runtime/macosx.x86_64/META-INF/MANIFEST.MF +++ b/ide/plugins/prob-runtime/macosx.x86_64/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Eclipse-BundleShape: dir Bundle-ManifestVersion: 2 Bundle-Name: org.overture.ide.plugins.probruntime Bundle-SymbolicName: org.overture.ide.plugins.probruntime.macosx.x86_64;singleton:=true -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Fragment-Host: org.overture.ide.plugins.probruntime.core Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/ide/plugins/prob-runtime/macosx.x86_64/pom.xml b/ide/plugins/prob-runtime/macosx.x86_64/pom.xml index 5449c88f37..c0a05c122c 100644 --- a/ide/plugins/prob-runtime/macosx.x86_64/pom.xml +++ b/ide/plugins/prob-runtime/macosx.x86_64/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.probruntime - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/prob-runtime/pom.xml b/ide/plugins/prob-runtime/pom.xml index 46665238de..a10cab57ec 100644 --- a/ide/plugins/prob-runtime/pom.xml +++ b/ide/plugins/prob-runtime/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/prob-runtime/win32.win32/META-INF/MANIFEST.MF b/ide/plugins/prob-runtime/win32.win32/META-INF/MANIFEST.MF index c6e97a8c57..4f52155a36 100644 --- a/ide/plugins/prob-runtime/win32.win32/META-INF/MANIFEST.MF +++ b/ide/plugins/prob-runtime/win32.win32/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Eclipse-BundleShape: dir Bundle-ManifestVersion: 2 Bundle-Name: org.overture.ide.plugins.probruntime Bundle-SymbolicName: org.overture.ide.plugins.probruntime.win32.win32;singleton:=true -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Fragment-Host: org.overture.ide.plugins.probruntime.core Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/ide/plugins/prob-runtime/win32.win32/pom.xml b/ide/plugins/prob-runtime/win32.win32/pom.xml index ecf0091db7..4efa3effbf 100644 --- a/ide/plugins/prob-runtime/win32.win32/pom.xml +++ b/ide/plugins/prob-runtime/win32.win32/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide.plugins org.overture.ide.plugins.probruntime - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/quickinterpreter/META-INF/MANIFEST.MF b/ide/plugins/quickinterpreter/META-INF/MANIFEST.MF index 69d341624b..40268e7091 100644 --- a/ide/plugins/quickinterpreter/META-INF/MANIFEST.MF +++ b/ide/plugins/quickinterpreter/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.plugins.quickinterpreter diff --git a/ide/plugins/quickinterpreter/pom.xml b/ide/plugins/quickinterpreter/pom.xml index 9bb7df4ca3..ac6f1b6184 100644 --- a/ide/plugins/quickinterpreter/pom.xml +++ b/ide/plugins/quickinterpreter/pom.xml @@ -4,7 +4,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/rttraceviewer/META-INF/MANIFEST.MF b/ide/plugins/rttraceviewer/META-INF/MANIFEST.MF index af0b7192e0..d453e84a78 100644 --- a/ide/plugins/rttraceviewer/META-INF/MANIFEST.MF +++ b/ide/plugins/rttraceviewer/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.plugins.rttraceviewer diff --git a/ide/plugins/rttraceviewer/pom.xml b/ide/plugins/rttraceviewer/pom.xml index 0ebd23541c..228c3c0a26 100644 --- a/ide/plugins/rttraceviewer/pom.xml +++ b/ide/plugins/rttraceviewer/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/uml2.tests/META-INF/MANIFEST.MF b/ide/plugins/uml2.tests/META-INF/MANIFEST.MF index cd699e450e..e713a02851 100644 --- a/ide/plugins/uml2.tests/META-INF/MANIFEST.MF +++ b/ide/plugins/uml2.tests/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.plugins.uml2.tests diff --git a/ide/plugins/uml2.tests/pom.xml b/ide/plugins/uml2.tests/pom.xml index 22fef9c076..411c5efc9b 100644 --- a/ide/plugins/uml2.tests/pom.xml +++ b/ide/plugins/uml2.tests/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/plugins/uml2/META-INF/MANIFEST.MF b/ide/plugins/uml2/META-INF/MANIFEST.MF index 7ece7f1dfe..d1ef1d302a 100644 --- a/ide/plugins/uml2/META-INF/MANIFEST.MF +++ b/ide/plugins/uml2/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Name: UML2 Translator Bundle-ManifestVersion: 2 diff --git a/ide/plugins/uml2/pom.xml b/ide/plugins/uml2/pom.xml index b5215568f2..df6bb1f585 100644 --- a/ide/plugins/uml2/pom.xml +++ b/ide/plugins/uml2/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.plugins - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/pom.xml b/ide/pom.xml index e1e466ce70..d8e41d0b97 100644 --- a/ide/pom.xml +++ b/ide/pom.xml @@ -5,7 +5,7 @@ org.overturetool root - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml pom diff --git a/ide/product/overture.product b/ide/product/overture.product index e8232eaddf..abcf95fd8a 100644 --- a/ide/product/overture.product +++ b/ide/product/overture.product @@ -1,7 +1,7 @@ - + diff --git a/ide/product/pom.xml b/ide/product/pom.xml index eabd1d4d73..f776f93735 100644 --- a/ide/product/pom.xml +++ b/ide/product/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/tests/pom.xml b/ide/tests/pom.xml index cf5bf26d54..cb321e9a51 100644 --- a/ide/tests/pom.xml +++ b/ide/tests/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/tests/ui/META-INF/MANIFEST.MF b/ide/tests/ui/META-INF/MANIFEST.MF index 6ff0e6f8c3..3816b288c1 100644 --- a/ide/tests/ui/META-INF/MANIFEST.MF +++ b/ide/tests/ui/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.tests.ui diff --git a/ide/tests/ui/pom.xml b/ide/tests/ui/pom.xml index 60a5b564ae..90ced7009c 100644 --- a/ide/tests/ui/pom.xml +++ b/ide/tests/ui/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.tests - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/ui/META-INF/MANIFEST.MF b/ide/ui/META-INF/MANIFEST.MF index 094459b3f2..944897fe14 100644 --- a/ide/ui/META-INF/MANIFEST.MF +++ b/ide/ui/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.ui diff --git a/ide/ui/pom.xml b/ide/ui/pom.xml index fa6b0df602..976176a014 100644 --- a/ide/ui/pom.xml +++ b/ide/ui/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmpp/core/META-INF/MANIFEST.MF b/ide/vdmpp/core/META-INF/MANIFEST.MF index 9df1c7d679..8886a09448 100644 --- a/ide/vdmpp/core/META-INF/MANIFEST.MF +++ b/ide/vdmpp/core/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmpp.core diff --git a/ide/vdmpp/core/pom.xml b/ide/vdmpp/core/pom.xml index 9840a56d96..af328756a3 100644 --- a/ide/vdmpp/core/pom.xml +++ b/ide/vdmpp/core/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.vdmpp - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmpp/debug/META-INF/MANIFEST.MF b/ide/vdmpp/debug/META-INF/MANIFEST.MF index eed98afada..9abf8974b6 100644 --- a/ide/vdmpp/debug/META-INF/MANIFEST.MF +++ b/ide/vdmpp/debug/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmpp.debug diff --git a/ide/vdmpp/debug/pom.xml b/ide/vdmpp/debug/pom.xml index 9d647d406d..6b7ca61be9 100644 --- a/ide/vdmpp/debug/pom.xml +++ b/ide/vdmpp/debug/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.vdmpp - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmpp/pom.xml b/ide/vdmpp/pom.xml index a5d06e0c63..ba614a8c56 100644 --- a/ide/vdmpp/pom.xml +++ b/ide/vdmpp/pom.xml @@ -4,7 +4,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmpp/ui/META-INF/MANIFEST.MF b/ide/vdmpp/ui/META-INF/MANIFEST.MF index 7a0cf73997..4a02ab043f 100644 --- a/ide/vdmpp/ui/META-INF/MANIFEST.MF +++ b/ide/vdmpp/ui/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmpp.ui diff --git a/ide/vdmpp/ui/pom.xml b/ide/vdmpp/ui/pom.xml index 95a4936a4d..c8a7f85167 100644 --- a/ide/vdmpp/ui/pom.xml +++ b/ide/vdmpp/ui/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.vdmpp - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmrt/core/META-INF/MANIFEST.MF b/ide/vdmrt/core/META-INF/MANIFEST.MF index 5e32237f0b..c093c84d8d 100644 --- a/ide/vdmrt/core/META-INF/MANIFEST.MF +++ b/ide/vdmrt/core/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmrt.core diff --git a/ide/vdmrt/core/pom.xml b/ide/vdmrt/core/pom.xml index 5e06f249e8..2ddd045c8f 100644 --- a/ide/vdmrt/core/pom.xml +++ b/ide/vdmrt/core/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.vdmrt - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmrt/debug/META-INF/MANIFEST.MF b/ide/vdmrt/debug/META-INF/MANIFEST.MF index 7343971b0c..d820b2d3ca 100644 --- a/ide/vdmrt/debug/META-INF/MANIFEST.MF +++ b/ide/vdmrt/debug/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmrt.debug diff --git a/ide/vdmrt/debug/pom.xml b/ide/vdmrt/debug/pom.xml index 6b9d6d8ddd..6bf1b83b8d 100644 --- a/ide/vdmrt/debug/pom.xml +++ b/ide/vdmrt/debug/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.vdmrt - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmrt/pom.xml b/ide/vdmrt/pom.xml index c286e1d102..13636ecb53 100644 --- a/ide/vdmrt/pom.xml +++ b/ide/vdmrt/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmrt/ui/META-INF/MANIFEST.MF b/ide/vdmrt/ui/META-INF/MANIFEST.MF index ab45460bc2..bab078f95f 100644 --- a/ide/vdmrt/ui/META-INF/MANIFEST.MF +++ b/ide/vdmrt/ui/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmrt.ui diff --git a/ide/vdmrt/ui/pom.xml b/ide/vdmrt/ui/pom.xml index bc26098c1f..62f019c5f4 100644 --- a/ide/vdmrt/ui/pom.xml +++ b/ide/vdmrt/ui/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.vdmrt - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmsl/core/META-INF/MANIFEST.MF b/ide/vdmsl/core/META-INF/MANIFEST.MF index fea7ad0176..02f7ed7ff5 100644 --- a/ide/vdmsl/core/META-INF/MANIFEST.MF +++ b/ide/vdmsl/core/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmsl.core diff --git a/ide/vdmsl/core/pom.xml b/ide/vdmsl/core/pom.xml index 9bdd2d2629..1de1aaf113 100644 --- a/ide/vdmsl/core/pom.xml +++ b/ide/vdmsl/core/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.vdmsl - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmsl/debug/META-INF/MANIFEST.MF b/ide/vdmsl/debug/META-INF/MANIFEST.MF index 11cc780a5d..f964ba9185 100644 --- a/ide/vdmsl/debug/META-INF/MANIFEST.MF +++ b/ide/vdmsl/debug/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmsl.debug diff --git a/ide/vdmsl/debug/pom.xml b/ide/vdmsl/debug/pom.xml index 8c0ac56d39..833f140bc8 100644 --- a/ide/vdmsl/debug/pom.xml +++ b/ide/vdmsl/debug/pom.xml @@ -4,7 +4,7 @@ org.overturetool.ide org.overture.ide.vdmsl - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmsl/pom.xml b/ide/vdmsl/pom.xml index d020dbeb25..22e5ac02f3 100644 --- a/ide/vdmsl/pom.xml +++ b/ide/vdmsl/pom.xml @@ -5,7 +5,7 @@ org.overturetool ide - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml diff --git a/ide/vdmsl/ui/META-INF/MANIFEST.MF b/ide/vdmsl/ui/META-INF/MANIFEST.MF index e68f97d04b..1b37e4d7dd 100644 --- a/ide/vdmsl/ui/META-INF/MANIFEST.MF +++ b/ide/vdmsl/ui/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Vendor: Overture Bundle-ActivationPolicy: lazy -Bundle-Version: 2.3.0 +Bundle-Version: 2.3.1.qualifier Eclipse-BuddyPolicy: registered Bundle-Localization: plugin Bundle-Name: org.overture.ide.vdmsl.ui diff --git a/ide/vdmsl/ui/pom.xml b/ide/vdmsl/ui/pom.xml index 8da3d711e9..c18b3eeb97 100644 --- a/ide/vdmsl/ui/pom.xml +++ b/ide/vdmsl/ui/pom.xml @@ -5,7 +5,7 @@ org.overturetool.ide org.overture.ide.vdmsl - 2.3.0 + 2.3.1-SNAPSHOT ../pom.xml From fcd68a3daa69da64beb560ce8903d9079ae8f0ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 10:19:08 +0200 Subject: [PATCH 078/706] Fix to construction fo fully qualified quote name --- .../org/overture/codegen/vdm2java/JavaQuoteValueCreator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java index 4eebf39981..f41d414da1 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java @@ -85,7 +85,7 @@ public static String consQuotePackage(String userCodePackage) public static String fullyQualifiedQuoteName(String userCodePackage, String vdmValueName) { - return consQuotePackage(userCodePackage) + "." + vdmValueName; + return consQuotePackage(userCodePackage) + "." + vdmValueName + JAVA_QUOTE_NAME_SUFFIX; } private AFieldDeclCG consHashcodeField() From e66eb8da5f88bb4d14c09d994a7c14151ce876a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 10:22:08 +0200 Subject: [PATCH 079/706] Generalise named type info --- .../java/org/overture/codegen/vdm2jml/AbstractTypeInfo.java | 6 ++++++ .../java/org/overture/codegen/vdm2jml/NamedTypeInfo.java | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AbstractTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AbstractTypeInfo.java index 509244d191..af433506a4 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AbstractTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AbstractTypeInfo.java @@ -4,6 +4,8 @@ public abstract class AbstractTypeInfo { + public static String ARG_PLACEHOLDER = "%1$s"; + protected boolean optional; public AbstractTypeInfo(boolean optional) @@ -19,4 +21,8 @@ public void makeOptional() abstract public boolean allowsNull(); abstract public List getLeafTypesRecursively(); + + abstract public boolean contains(AbstractTypeInfo subject); + + abstract public String consCheckExp(String enclosingClass, String javaRootPackage); } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInfo.java index 623ccdec1a..c82c72a91f 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInfo.java @@ -5,8 +5,6 @@ public class NamedTypeInfo extends AbstractTypeInfo { - private static String ARG_PLACEHOLDER = "%1$s"; - private String typeName; private String defModule; private boolean hasInv; @@ -48,7 +46,7 @@ public List getLeafTypes() return leafTypes; } - public boolean contains(NamedTypeInfo other) + public boolean contains(AbstractTypeInfo other) { if (equals(other)) { From 09b7a5a91f5d6ce5b1f65ff3398f926232f03a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 10:29:19 +0200 Subject: [PATCH 080/706] Update leaf types to support construction of dynamic type checks --- .../codegen/vdm2jml/LeafTypeInfo.java | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java index 8be72bca47..7d18c011bf 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java @@ -1,14 +1,58 @@ package org.overture.codegen.vdm2jml; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import org.overture.codegen.cgast.STypeCG; +import org.overture.codegen.cgast.types.ABoolBasicTypeCG; +import org.overture.codegen.cgast.types.ACharBasicTypeCG; +import org.overture.codegen.cgast.types.AIntNumericBasicTypeCG; +import org.overture.codegen.cgast.types.ANat1NumericBasicTypeCG; +import org.overture.codegen.cgast.types.ANatNumericBasicTypeCG; +import org.overture.codegen.cgast.types.AQuoteTypeCG; +import org.overture.codegen.cgast.types.ARatNumericBasicTypeCG; +import org.overture.codegen.cgast.types.ARealNumericBasicTypeCG; +import org.overture.codegen.cgast.types.ARecordTypeCG; +import org.overture.codegen.cgast.types.ATokenBasicTypeCG; +import org.overture.codegen.logging.Logger; +import org.overture.codegen.runtime.Utils; +import org.overture.codegen.vdm2java.JavaQuoteValueCreator; public class LeafTypeInfo extends AbstractTypeInfo { + private static final String CLASS_QUALIFIER = ".class"; + private static final String IS_BOOL = "is_bool"; + private static final String IS_NAT = "is_nat"; + private static final String IS_NAT1 = "is_nat1"; + private static final String IS_INT = "is_int"; + private static final String IS_RAT = "is_rat"; + private static final String IS_REAL = "is_real"; + private static final String IS_CHAR = "is_char"; + private static final String IS_TOKEN = "is_token"; + private static final String IS = "is_"; + private STypeCG type; + private static Map, String> utilsCallMap; + + static + { + utilsCallMap = new HashMap<>(); + utilsCallMap.put(ABoolBasicTypeCG.class, IS_BOOL); + utilsCallMap.put(ANatNumericBasicTypeCG.class, IS_NAT); + utilsCallMap.put(ANat1NumericBasicTypeCG.class, IS_NAT1); + utilsCallMap.put(AIntNumericBasicTypeCG.class, IS_INT); + utilsCallMap.put(ARatNumericBasicTypeCG.class, IS_RAT); + utilsCallMap.put(ARealNumericBasicTypeCG.class, IS_REAL); + utilsCallMap.put(ACharBasicTypeCG.class, IS_CHAR); + utilsCallMap.put(ATokenBasicTypeCG.class, IS_TOKEN); + utilsCallMap.put(AQuoteTypeCG.class, IS); + utilsCallMap.put(ARecordTypeCG.class, IS); + //TODO: String types need treatment + } + public LeafTypeInfo(STypeCG type, boolean optional) { super(optional); @@ -48,4 +92,78 @@ public List getLeafTypesRecursively() return types; } + + @Override + public boolean contains(AbstractTypeInfo subject) + { + //TODO: Returning false leads to redundant dynamic type check which is not optimal + return false; + } + + + public String concCheckCall(String s) + { + return concCheckCall(s, null); + } + + public String concCheckCall(String s, String arg) + { + String call = Utils.class.getSimpleName() + "." + s + "(" + ARG_PLACEHOLDER; + + if(arg != null) + { + call += "," + arg; + } + + call += ")"; + + return call; + } + + @Override + public String consCheckExp(String enclosingClass, String javaRootPackage) + { + String methodName = utilsCallMap.get(type.getClass()); + + if(methodName == null) + { + Logger.getLog().printErrorln("Got unhandled case"); + return null; + } + + String call; + if(type instanceof AQuoteTypeCG) + { + String qouteValue = ((AQuoteTypeCG) type).getValue(); + String quoteType = JavaQuoteValueCreator.fullyQualifiedQuoteName(javaRootPackage, qouteValue); + call = concCheckCall(methodName, quoteType + CLASS_QUALIFIER); + } + else if(type instanceof ARecordTypeCG) + { + ARecordTypeCG rt = (ARecordTypeCG) type; + String defClass = rt.getName().getDefiningClass(); + String recPackage = JmlGenUtil.consRecPackage(defClass, javaRootPackage); + String fullyQualifiedRecType = recPackage + "." + + rt.getName().getName(); + + call = concCheckCall(methodName, fullyQualifiedRecType + CLASS_QUALIFIER); + } + else + { + call = concCheckCall(methodName); + } + + // If the type is optional 'null' is also a legal value + if(optional) + { + return "(" + ARG_PLACEHOLDER + " == null || " + call + ")"; + } + + return call; + } + + public static Map, String> getUtilsCallMap() + { + return utilsCallMap; + } } From 3732425f06e92e8d265e0e51d5d7120aedf08cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 13:13:34 +0200 Subject: [PATCH 081/706] Added test to check if the dynamic type check methods used by 'LeafTypeInfo' can be found in the runtime library --- .../vdm2jml/tests/LeafTypeCallTests.java | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java new file mode 100644 index 0000000000..b749cec833 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java @@ -0,0 +1,101 @@ +package org.overture.vdm2jml.tests; + +import java.lang.reflect.Method; +import java.util.Arrays; + +import org.junit.Assert; +import org.junit.Test; +import org.overture.codegen.cgast.STypeCG; +import org.overture.codegen.cgast.types.ABoolBasicTypeCG; +import org.overture.codegen.cgast.types.ACharBasicTypeCG; +import org.overture.codegen.cgast.types.AIntNumericBasicTypeCG; +import org.overture.codegen.cgast.types.ANat1NumericBasicTypeCG; +import org.overture.codegen.cgast.types.ANatNumericBasicTypeCG; +import org.overture.codegen.cgast.types.AQuoteTypeCG; +import org.overture.codegen.cgast.types.ARatNumericBasicTypeCG; +import org.overture.codegen.cgast.types.ARealNumericBasicTypeCG; +import org.overture.codegen.cgast.types.ARecordTypeCG; +import org.overture.codegen.cgast.types.ATokenBasicTypeCG; +import org.overture.codegen.runtime.Utils; +import org.overture.codegen.vdm2jml.LeafTypeInfo; + +public class LeafTypeCallTests +{ + @Test + public void boolCheck() + { + assertMethod(ABoolBasicTypeCG.class, Object.class); + } + + @Test + public void natCheck() + { + assertMethod(ANatNumericBasicTypeCG.class, Object.class); + } + + @Test + public void nat1Check() + { + assertMethod(ANat1NumericBasicTypeCG.class, Object.class); + } + + @Test + public void intCheck() + { + assertMethod(AIntNumericBasicTypeCG.class, Object.class); + } + + @Test + public void ratCheck() + { + assertMethod(ARatNumericBasicTypeCG.class, Object.class); + } + + @Test + public void realCheck() + { + assertMethod(ARealNumericBasicTypeCG.class, Object.class); + } + + @Test + public void charCheck() + { + assertMethod(ACharBasicTypeCG.class, Object.class); + } + + @Test + public void tokenCheck() + { + assertMethod(ATokenBasicTypeCG.class, Object.class); + } + + @Test + public void quoteCheck() + { + assertMethod(AQuoteTypeCG.class, Object.class, Class.class); + } + + @Test + public void recTest() + { + assertMethod(ARecordTypeCG.class, Object.class, Class.class); + } + + private void assertMethod(Class type, Class... paramTypes) + { + String methodName = LeafTypeInfo.getUtilsCallMap().get(type); + Assert.assertNotNull("Could not find method name corresponding to type '" + type + "'", methodName); + + Method method = null; + try + { + method = Utils.class.getMethod(methodName, paramTypes); + } catch (NoSuchMethodException | SecurityException e) + { + // Do nothing + } + + Assert.assertNotNull("Could not find method corresponding to type ;" + type + "' with arguments " + + Arrays.toString(paramTypes), method); + } +} From 4c7a1432755e4e1ae948a8f4f8bd620cb5b2b0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 13:26:26 +0200 Subject: [PATCH 082/706] Refactoring of record related functionality --- .../java/org/overture/codegen/vdm2jml/JmlGenUtil.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java index c9c9818162..64ac7efdb1 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java @@ -302,7 +302,7 @@ public List> makeRecsOuterClasses(List> ast, Rec // Examples: my.pack.Mtypes if (JavaCodeGenUtil.isValidJavaPackage(jmlGen.getJavaSettings().getJavaRootPackage())) { - String recPackage = consRecPackage(clazz.getName()); + String recPackage = consRecPackage(clazz.getName(), jmlGen.getJavaSettings().getJavaRootPackage()); recClass.setPackage(recPackage); } else { @@ -316,13 +316,13 @@ public List> makeRecsOuterClasses(List> ast, Rec return extraClasses; } - public String consRecPackage(String defClass) + public static String consRecPackage(String defClass, String javaRootPackage) { String recPackage = ""; - if (JavaCodeGenUtil.isValidJavaPackage(jmlGen.getJavaSettings().getJavaRootPackage())) + if (JavaCodeGenUtil.isValidJavaPackage(javaRootPackage)) { - recPackage += jmlGen.getJavaSettings().getJavaRootPackage() + "."; + recPackage += javaRootPackage + "."; } recPackage += defClass + JavaFormat.TYPE_DECL_PACKAGE_SUFFIX; From 35c476e47d6c429d4ec2a0c927bbdd8f284b9dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 18:53:26 +0200 Subject: [PATCH 083/706] Update type info finder to collect information about leaf types --- .../vdm2jml/NamedTypeInvDepCalculator.java | 22 +++--- .../codegen/vdm2jml/NamedTypeInvUtil.java | 70 +++++++++++++++---- 2 files changed, 66 insertions(+), 26 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java index 56bb615ca9..db950e896b 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java @@ -47,12 +47,12 @@ public static NamedTypeInfo findTypeInfo(List typeInfoList, return null; } - public static List onlyDisjointTypes( - List typeInfo) + public static List onlyDisjointTypes( + List typeInfo) { - List disjointTypes = new LinkedList(); + List disjointTypes = new LinkedList(); - for (NamedTypeInfo t : typeInfo) + for (AbstractTypeInfo t : typeInfo) { if (!contains(disjointTypes, t)) { @@ -64,12 +64,12 @@ public static List onlyDisjointTypes( return disjointTypes; } - public static void removeSmallerTypes(List disjointTypes, - NamedTypeInfo subject) + public static void removeSmallerTypes(List disjointTypes, + AbstractTypeInfo subject) { - List toRemove = new LinkedList(); + List toRemove = new LinkedList<>(); - for (NamedTypeInfo nexType : disjointTypes) + for (AbstractTypeInfo nexType : disjointTypes) { if (subject.contains(nexType)) { @@ -80,10 +80,10 @@ public static void removeSmallerTypes(List disjointTypes, disjointTypes.removeAll(toRemove); } - public static boolean contains(List typeInfoList, - NamedTypeInfo subject) + public static boolean contains(List typeInfoList, + AbstractTypeInfo subject) { - for (NamedTypeInfo nextType : typeInfoList) + for (AbstractTypeInfo nextType : typeInfoList) { if (nextType.contains(subject)) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java index 42053de9a3..a218ff7144 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java @@ -9,8 +9,13 @@ import org.overture.codegen.cgast.declarations.ANamedTypeDeclCG; import org.overture.codegen.cgast.expressions.SVarExpCG; import org.overture.codegen.cgast.statements.AMetaStmCG; +import org.overture.codegen.cgast.types.AMapMapTypeCG; import org.overture.codegen.cgast.types.ARecordTypeCG; +import org.overture.codegen.cgast.types.ASeqSeqTypeCG; +import org.overture.codegen.cgast.types.ASetSetTypeCG; +import org.overture.codegen.cgast.types.ATupleTypeCG; import org.overture.codegen.cgast.types.AUnionTypeCG; +import org.overture.codegen.cgast.types.AUnknownTypeCG; import org.overture.codegen.logging.Logger; public class NamedTypeInvUtil @@ -23,12 +28,15 @@ public NamedTypeInvUtil(NamedTypeInvHandler handler) } public String consJmlCheck(String enclosingClass, String jmlVisibility, - String annotationType, boolean invChecksGuard, List typeInfoMatches, + String annotationType, boolean invChecksGuard, List typeInfoMatches, SVarExpCG var) { StringBuilder inv = new StringBuilder(); - appendRecValidChecks(invChecksGuard, typeInfoMatches, var, inv); + if(handler.getInvAssertTrans().buildRecValidChecks()) + { + appendRecValidChecks(invChecksGuard, typeInfoMatches, var, inv); + } inv.append("//@ "); @@ -48,10 +56,22 @@ public String consJmlCheck(String enclosingClass, String jmlVisibility, } String or = ""; - for (NamedTypeInfo match : typeInfoMatches) + for (AbstractTypeInfo match : typeInfoMatches) { + String javaPackage = handler.getJmlGen().getJavaSettings().getJavaRootPackage(); + String consCheckExp = match.consCheckExp(enclosingClass, javaPackage); inv.append(or); - inv.append(match.consCheckExp(enclosingClass, handler.getJmlGen().getJavaSettings().getJavaRootPackage())); + if(consCheckExp != null) + { + inv.append(consCheckExp); + } + else + { + Logger.getLog().printErrorln("Expression could not be checked in '" + + this.getClass().getSimpleName() + "'"); + //TODO: Consider better handling + inv.append("true"); + } or = JmlGenerator.JML_OR; } @@ -76,7 +96,7 @@ private String consInvChecksGuard() } private void appendRecValidChecks(boolean invChecksGuard, - List typeInfoMatches, SVarExpCG var, + List typeInfoMatches, SVarExpCG var, StringBuilder inv) { List recordTypes = getRecTypes(typeInfoMatches); @@ -85,10 +105,7 @@ private void appendRecValidChecks(boolean invChecksGuard, { for (ARecordTypeCG rt : recordTypes) { - String defClass = rt.getName().getDefiningClass(); - String recPackage = handler.getJmlGen().getUtil().consRecPackage(defClass); - String fullyQualifiedRecType = recPackage + "." - + rt.getName().getName(); + String fullyQualifiedRecType = fullyQualifiedRecType(rt); inv.append("//@ "); inv.append(JmlGenerator.JML_ASSERT_ANNOTATION); @@ -121,13 +138,22 @@ private void appendRecValidChecks(boolean invChecksGuard, } } } + + public String fullyQualifiedRecType(ARecordTypeCG rt) + { + String defClass = rt.getName().getDefiningClass(); + String recPackage = JmlGenUtil.consRecPackage(defClass, handler.getJmlGen().getJavaGen().getJavaSettings().getJavaRootPackage()); + String fullyQualifiedRecType = recPackage + "." + + rt.getName().getName(); + return fullyQualifiedRecType; + } private List getRecTypes( - List typeInfoMatches) + List typeInfoMatches) { List recTypes = new LinkedList<>(); - for (NamedTypeInfo match : typeInfoMatches) + for (AbstractTypeInfo match : typeInfoMatches) { List leaves = match.getLeafTypesRecursively(); @@ -143,7 +169,7 @@ private List getRecTypes( return recTypes; } - public AMetaStmCG consAssertStm(List invTypes, + public AMetaStmCG consAssertStm(List invTypes, String encClassName, SVarExpCG var, INode node, RecClassInfo recInfo) { boolean inAccessor = node != null && recInfo != null && recInfo.inAccessor(node); @@ -172,9 +198,9 @@ public AMetaStmCG consVarNotNullAssert(String varName) // } - public List findNamedInvTypes(STypeCG type) + public List findTypeInfo(STypeCG type) { - List posTypes = new LinkedList(); + List posTypes = new LinkedList<>(); if (type.getNamedInvType() != null) { @@ -200,9 +226,23 @@ public List findNamedInvTypes(STypeCG type) { for (STypeCG t : ((AUnionTypeCG) type).getTypes()) { - posTypes.addAll(findNamedInvTypes(t)); + posTypes.addAll(findTypeInfo(t)); } } + else if(type instanceof AUnknownTypeCG) + { + return posTypes; + } + else if(type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG || type instanceof ASeqSeqTypeCG || type instanceof ATupleTypeCG) + { + // Can't do anything for these right now... + // TODO: implement handling + return posTypes; + } + else + { + posTypes.add(new LeafTypeInfo(type, handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type))); + } // We will only consider types that are disjoint. As an example consider // the type definitions below: From 4199bdc888abffc621cf8c9d93b664cbd748d292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 19:00:24 +0200 Subject: [PATCH 084/706] Update named type invariant handler to use new type info finder --- .../codegen/vdm2jml/NamedTypeInvHandler.java | 156 ++++++++---------- 1 file changed, 69 insertions(+), 87 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java index 11f80a063e..5256683ee3 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java @@ -3,6 +3,7 @@ import java.util.LinkedList; import java.util.List; +import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; @@ -34,6 +35,11 @@ public class NamedTypeInvHandler implements IAssert private InvAssertionTrans invTrans; private NamedTypeInvUtil util; + public InvAssertionTrans getInvAssertTrans() + { + return invTrans; + } + public NamedTypeInvHandler(InvAssertionTrans invTrans) { this.invTrans = invTrans; @@ -69,13 +75,13 @@ public void handleField(AFieldDeclCG node) return; } - if (!invTrans.getRecInfo().isRecField(node)) + if (!invTrans.getRecInfo().isRecField(node) && node.getFinal()) { /** * So at this point it must be a value defined in a module. No need to check if invariant checks are enabled. */ - List invTypes = util.findNamedInvTypes(node.getType()); + List invTypes = util.findTypeInfo(node.getType()); if (!invTypes.isEmpty()) { @@ -157,9 +163,9 @@ public void handleReturn(AReturnStmCG node) throws AnalysisException STypeCG returnType = encMethod.getMethodType().getResult(); - List invTypes = util.findNamedInvTypes(returnType); + List invTypes = util.findTypeInfo(returnType); - if (invTypes.isEmpty() && !varMayBeNull(returnType)) + if (invTypes.isEmpty()) { return; } @@ -182,12 +188,17 @@ public void handleReturn(AReturnStmCG node) throws AnalysisException public void handleMethod(AMethodDeclCG node) throws AnalysisException { + if(!treatMethod(node)) + { + return; + } + // Upon entering the method, assert that the parameters are valid wrt. their named invariant types. ABlockStmCG replBody = new ABlockStmCG(); for (AFormalParamLocalParamCG param : node.getFormalParams()) { - List invTypes = util.findNamedInvTypes(param.getType()); + List invTypes = util.findTypeInfo(param.getType()); if (!invTypes.isEmpty()) { @@ -216,15 +227,6 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException AMetaStmCG as = util.consAssertStm(invTypes, encClassName, var, node, invTrans.getRecInfo()); replBody.getStatements().add(as); } - else - { - if(varMayBeNull(param.getType())) - { - String varNameStr = invTrans.getJmlGen().getUtil().getName(param.getPattern()); - AMetaStmCG as = util.consVarNotNullAssert(varNameStr); - replBody.getStatements().add(as); - } - } } SStmCG body = node.getBody(); @@ -248,7 +250,22 @@ public AMetaStmCG handleMapSeq(AMapSeqUpdateStmCG node) SVarExpCG var = ((SVarExpCG) col); - List invTypes = util.findNamedInvTypes(var.getType()); + if (varMayBeNull(var.getType())) + { + // The best we can do is to assert that the map/seq subject to modification is + // not null although we eventually get the null pointer exception, e.g. + // + // //@ azzert m != null + // Utils.mapSeqUpdate(m,1L,1L); + AMetaStmCG assertNotNull = util.consVarNotNullAssert(var.getName()); + + ABlockStmCG replStm = new ABlockStmCG(); + getTransAssist().replaceNodeWith(node, replStm); + replStm.getStatements().add(assertNotNull); + replStm.getStatements().add(node); + } + + List invTypes = util.findTypeInfo(var.getType()); if (!invTypes.isEmpty()) { @@ -267,23 +284,6 @@ public AMetaStmCG handleMapSeq(AMapSeqUpdateStmCG node) return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, invTrans.getRecInfo()); } } - else - { - if(varMayBeNull(var.getType())) - { - // The best we can do is to assert that the map/seq subject to modification is - // not null although we eventually get the null pointer exception, e.g. - // - // //@ azzert m != null - // Utils.mapSeqUpdate(m,1L,1L); - AMetaStmCG assertNotNull = util.consVarNotNullAssert(var.getName()); - - ABlockStmCG replStm = new ABlockStmCG(); - getTransAssist().replaceNodeWith(node, replStm); - replStm.getStatements().add(assertNotNull); - replStm.getStatements().add(node); - } - } return null; } @@ -294,7 +294,7 @@ public AMetaStmCG handleVarDecl(AVarDeclCG node) // let x : Even = 1 in ... // (dcl y : Even | nat := 2; ...) - List invTypes = util.findNamedInvTypes(node.getType()); + List invTypes = util.findTypeInfo(node.getType()); if (!invTypes.isEmpty()) { @@ -320,24 +320,8 @@ public AMetaStmCG handleVarDecl(AVarDeclCG node) */ return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, invTrans.getRecInfo()); } - else - { - if(varMayBeNull(node.getType()) && rightHandSideMayBeNull(node.getExp())) - { - String name = invTrans.getJmlGen().getUtil().getName(node.getPattern()); - - if (name == null) - { - return null; - } - - return util.consVarNotNullAssert(name); - } - else - { - return null; - } - } + + return null; } public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) @@ -351,7 +335,24 @@ public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) { SVarExpCG recObjVar = (SVarExpCG) recObj; - List invTypes = util.findNamedInvTypes(recObj.getType()); + if(varMayBeNull(recObj.getType())) + { + // The best we can do is to assert that the record subject to modification is + // not null although we eventually get the null pointer exception, e.g. + // + // //@ azzert rec != null + // rec.set_x(5); + AMetaStmCG assertNotNull = util.consVarNotNullAssert(recObjVar.getName()); + + ABlockStmCG replStm = new ABlockStmCG(); + getTransAssist().replaceNodeWith(node, replStm); + replStm.getStatements().add(assertNotNull); + replStm.getStatements().add(node); + + return null; + } + + List invTypes = util.findTypeInfo(recObj.getType()); if (!invTypes.isEmpty()) { @@ -368,26 +369,6 @@ public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) */ return util.consAssertStm(invTypes, encClass.getName(), recObjVar, node, invTrans.getRecInfo()); } - else - { - if(varMayBeNull(recObj.getType())) - { - // The best we can do is to assert that the record subject to modification is - // not null although we eventually get the null pointer exception, e.g. - // - // //@ azzert rec != null - // rec.set_x(5); - AMetaStmCG assertNotNull = util.consVarNotNullAssert(recObjVar.getName()); - - ABlockStmCG replStm = new ABlockStmCG(); - getTransAssist().replaceNodeWith(node, replStm); - replStm.getStatements().add(assertNotNull); - replStm.getStatements().add(node); - - return null; - } - } - } else { @@ -425,7 +406,7 @@ public void handleAssign(AAssignToExpStmCG node) SVarExpCG var = (SVarExpCG) target; - List invTypes = util.findNamedInvTypes(node.getTarget().getType()); + List invTypes = util.findTypeInfo(node.getTarget().getType()); if (!invTypes.isEmpty()) { @@ -443,14 +424,6 @@ public void handleAssign(AAssignToExpStmCG node) AMetaStmCG assertStm = util.consAssertStm(invTypes, encClass.getName(), var, node, invTrans.getRecInfo()); addAssert(node, assertStm); } - else - { - if(varMayBeNull(node.getTarget().getType()) && rightHandSideMayBeNull(node.getExp())) - { - AMetaStmCG assertStm = util.consVarNotNullAssert(var.getName()); - addAssert(node, assertStm); - } - } } public ABlockStmCG getEncBlockStm(AVarDeclCG varDecl) @@ -507,7 +480,7 @@ public JmlGenerator getJmlGen() @Override public AMetaStmCG consAssert(AIdentifierVarExpCG var) { - List invTypes = util.findNamedInvTypes(var.getType()); + List invTypes = util.findTypeInfo(var.getType()); if (invTypes.isEmpty()) { @@ -544,21 +517,30 @@ public boolean rightHandSideMayBeNull(SExpCG exp) private boolean varMayBeNull(STypeCG type) { - if(inModuleToStringMethod(type)) + return treatMethod(type) && !getInfo().getTypeAssistant().allowsNull(type); + } + + private boolean treatMethod(INode node) + { + if(inModuleToStringMethod(node)) { return false; } // Some of the record methods inherited from object use native java type that can never be null - if(invTrans.getRecInfo().inRec(type) && !invTrans.getRecInfo().inAccessor(type)) + + if(invTrans.getRecInfo().inRec(node)) { - return false; + if(!(invTrans.getRecInfo().inAccessor(node) || invTrans.getRecInfo().inRecConstructor(node))) + { + return false; + } } - return !getInfo().getTypeAssistant().allowsNull(type); + return true; } - private boolean inModuleToStringMethod(STypeCG type) + private boolean inModuleToStringMethod(INode type) { AMethodDeclCG m = type.getAncestor(AMethodDeclCG.class); From 98c58b5bb28a565b2bff997bccc421422f2346e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 19:03:28 +0200 Subject: [PATCH 085/706] Add flag to indicating if records needs checking --- .../overture/codegen/vdm2jml/InvAssertionTrans.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java index f6c166d93b..8255ad1156 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java @@ -34,6 +34,8 @@ public class InvAssertionTrans extends AtomicAssertTrans private StateDesInfo stateDesInfo; private RecClassInfo recInfo; + private boolean buildRecChecks = false; + public InvAssertionTrans(JmlGenerator jmlGen, StateDesInfo stateDesInfo, RecClassInfo recInfo) { @@ -279,10 +281,12 @@ private List consObjVarAsserts( private void addAsserts(List objVarAsserts, AIdentifierVarExpCG var) { - add(objVarAsserts, recHandler.consAssert(var)); // TODO: Will the named type invariants not get handled automatically since they are local variable // decls. + buildRecChecks = true; add(objVarAsserts, namedTypeHandler.consAssert(var)); + add(objVarAsserts, recHandler.consAssert(var)); + buildRecChecks = false; } private void add(List asserts, AMetaStmCG as) @@ -310,4 +314,9 @@ public StateDesInfo getStateDesInfo() { return stateDesInfo; } + + public boolean buildRecValidChecks() + { + return buildRecChecks; + } } From 2f8254a215baf91b9b58006805a6694486a3aeee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 19:04:25 +0200 Subject: [PATCH 086/706] Expect new type of assertion in 'ModuleStateInvTests' --- .../java/org/overture/vdm2jml/tests/ModuleStateInvTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java index bd91ef81da..83c532fb69 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java @@ -81,7 +81,7 @@ public static void checkAssertion(String methodName, Update update, String assertStr = metaData.get(0).value; Assert.assertTrue("Got unexpected assertion in method '" - + methodName + "'", assertStr.contains(".valid()") || assertStr.contains("!= null")); + + methodName + "': " + assertStr, assertStr.contains(".valid()") || assertStr.contains("!= null") || assertStr.contains(".is_")); } } else { From e51552ff77fd580279fcc176ed15b6919253d986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 19:31:23 +0200 Subject: [PATCH 087/706] Updates to test artefacts: Changes to JML execution traces --- .../AtomicStateInvViolation.vdmsl.result | 2 +- .../MaskedRecInvViolated.vdmsl.result | 259 ++++++++++++++---- .../MaskedRecNamedTypeInv.vdmsl.result | 2 +- .../ModifyRecInMap.vdmsl.result | 8 +- .../NamedTypeInvUnionTypeRec.vdmsl.result | 16 +- .../RecInRecInAtomic.vdmsl.result | 10 +- .../RecInRecInvViolation.vdmsl.result | 97 ++++--- .../RecWithMapOfRec.vdmsl.result | 2 +- .../NamedTypeInvLocalDecls.vdmsl.result | 2 +- .../NamedTypeInvMapUpdate.vdmsl.result | 2 +- .../NamedTypeInvMethodParam.vdmsl.result | 2 +- .../NamedTypeInvSeqUpdate.vdmsl.result | 2 +- .../AssignBoolTypeViolation.vdmsl.result | 4 +- .../FuncReturnTokenViolation.vdmsl.result | 6 +- .../OpParamQuoteTypeViolation.vdmsl.result | 4 +- .../VarDeclTypeViolation.vdmsl.result | 2 +- .../recinv/StateInv/StateInv.vdmsl.result | 4 +- 17 files changed, 308 insertions(+), 116 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result index 42addc4758..425de969b9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result @@ -1,5 +1,5 @@ "Before first atomic (expecting violation after atomic)" -St.java:60: JML invariant is false on leaving method project.Entrytypes.St.valid() +St.java:63: JML invariant is false on leaving method project.Entrytypes.St.valid() public Boolean valid() { ^ St.java:13: Associated declaration diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result index 3980471011..bb6b9591c1 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result @@ -1,175 +1,322 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:60: JML invariant is false on leaving method project.Entrytypes.R3.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:63: JML invariant is false on leaving method project.Entrytypes.R3.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:63: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:19: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:22: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) public boolean equals(final Object obj) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:19: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:22: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:158: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:184: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) return !(Utils.equals(t3.get_r4().get_x(), 10L)); ^ -Entry.java:158: +Entry.java:184: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:45: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() public project.Entrytypes.R4 get_r4() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:45: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:48: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: JML invariant is false + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) + public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:74: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result index 4c627ab848..e7be4c86f6 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -Entry.java:115: JML assertion is false +Entry.java:130: JML assertion is false //@ assert inv_Entry_T3(stateDes_8); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result index 7b91606957..4db9c9c17d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result @@ -1,7 +1,13 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:60: JML invariant is false on leaving method project.Entrytypes.A.valid() +A.java:54: JML invariant is false on leaving method project.Entrytypes.A.valid() + public Boolean valid() { + ^ +A.java:13: Associated declaration + //@ public instance invariant project.Entry.invChecksOn ==> inv_A(m); + ^ +A.java:54: JML invariant is false on leaving method project.Entrytypes.A.valid() public Boolean valid() { ^ A.java:13: Associated declaration diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result index 0efe3fad10..a2c0397cbc 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result @@ -1,28 +1,28 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:60: JML invariant is false on leaving method project.Entrytypes.R3.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:63: JML invariant is false on leaving method project.Entrytypes.R3.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:63: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:19: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) public boolean equals(final Object obj) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:19: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:209: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:235: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) apply_9 = ((project.Entrytypes.R3) t3).get_r4(); ^ -Entry.java:209: +Entry.java:235: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:45: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() public project.Entrytypes.R4 get_r4() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:45: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result index bf78464d94..c2f1d2fd4e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result @@ -1,10 +1,16 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:60: JML invariant is false on leaving method project.Entrytypes.R1.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: JML invariant is false on leaving method project.Entrytypes.R1.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: JML invariant is false on leaving method project.Entrytypes.R1.valid() + public Boolean valid() { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result index fee9a7cdba..c5e7263a47 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result @@ -1,106 +1,139 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:60: JML invariant is false on leaving method project.Entrytypes.T2.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: JML invariant is false on leaving method project.Entrytypes.T2.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:60: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: JML invariant is false on leaving method project.Entrytypes.T2.valid() + public Boolean valid() { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: + //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) + public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) + public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) + public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) + public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: + //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: JML invariant is false + //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:45: JML invariant is false on leaving method project.Entrytypes.T1.get_t2() (for result type) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:48: JML invariant is false on leaving method project.Entrytypes.T1.get_t2() (for result type) public project.Entrytypes.T2 get_t2() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:45: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:48: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:66: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -Entry.java:70: JML invariant is false on entering method project.Entrytypes.T2.get_t3() from project.Entry.useNotOk() +Entry.java:102: JML invariant is false on entering method project.Entrytypes.T2.get_t3() from project.Entry.useNotOk() project.Entrytypes.T3 stateDes_11 = stateDes_10.get_t3(); ^ -Entry.java:70: +Entry.java:102: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:45: JML invariant is false on leaving method project.Entrytypes.T2.get_t3() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:48: JML invariant is false on leaving method project.Entrytypes.T2.get_t3() public project.Entrytypes.T3 get_t3() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:45: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:48: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result index d4022a002b..dd6fd80f50 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:52: JML invariant is false on leaving method project.Entrytypes.A.set_m(org.overture.codegen.runtime.VDMMap) +A.java:49: JML invariant is false on leaving method project.Entrytypes.A.set_m(org.overture.codegen.runtime.VDMMap) public void set_m(final VDMMap _m) { ^ A.java:13: Associated declaration diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result index 56466e57f6..2f4188d627 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result @@ -1,5 +1,5 @@ "Before breaking named type invariant" -Entry.java:31: JML assertion is false +Entry.java:34: JML assertion is false //@ assert inv_Entry_No(notLarge) && (inv_Entry_Even(notLarge) || inv_Entry_Large(notLarge)); ^ "After breaking named type invariant" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result index b0f7a34dc0..a06bcecbf4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for sequence" -Entry.java:25: JML assertion is false +Entry.java:30: JML assertion is false //@ assert inv_Entry_M(m); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result index 3ea6b57db9..6576c83ece 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for method parameter" -Entry.java:48: JML assertion is false +Entry.java:49: JML assertion is false //@ assert inv_Entry_Even(c); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result index f363321440..ee6e06baa2 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for sequence" -Entry.java:25: JML assertion is false +Entry.java:30: JML assertion is false //@ assert inv_Entry_S(s); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result index 0847b66076..3c33804286 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result @@ -1,7 +1,7 @@ "Before doing valid assignments" "After doing valid assignments" "Before doing illegal assignments" -Entry.java:28: JML assertion is false - //@ assert b != null; +Entry.java:31: JML assertion is false + //@ assert Utils.is_bool(b); ^ "After doing illegal assignments" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result index 516f7b9ab5..d3c69e6ebb 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result @@ -1,10 +1,10 @@ "Before evaluating ok()" "After evaluating ok()" "Before evaluating error()" -Entry.java:58: JML assertion is false - //@ assert ret_2 != null; +Entry.java:60: JML assertion is false + //@ assert Utils.is_token(ret_2); ^ Entry.java:32: JML assertion is false - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_token(ignorePattern_2); ^ "After evaluating error()" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result index 2fa5ae1696..c95f55429e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result @@ -1,7 +1,7 @@ "Before passing LEGAL value" "After passing LEGAL value" "Before passing ILLEGAL value" -Entry.java:33: JML assertion is false - //@ assert ignorePattern_1 != null; +Entry.java:34: JML assertion is false + //@ assert Utils.is_(ignorePattern_1,project.quotes.AQuote.class); ^ "After passing ILLEGAL value" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result index 5e672dddc3..674bc418ec 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result @@ -2,6 +2,6 @@ "After VALID initialisation" "Before INVALID initialisation" Entry.java:32: JML assertion is false - //@ assert bError != null; + //@ assert Utils.is_nat(bError); ^ "After INVALID initialisation" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result index 467006df50..ff94b2cea9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result @@ -1,11 +1,11 @@ "Before breaking state invariant" -St.java:52: JML invariant is false on leaving method project.Entrytypes.St.set_x(java.lang.Number) +St.java:55: JML invariant is false on leaving method project.Entrytypes.St.set_x(java.lang.Number) public void set_x(final Number _x) { ^ St.java:13: Associated declaration //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); ^ -Entry.java:51: JML invariant is false on entering method project.Entrytypes.St.set_x(java.lang.Number) from project.Entry.op() +Entry.java:52: JML invariant is false on entering method project.Entrytypes.St.set_x(java.lang.Number) from project.Entry.op() St.set_x(10L); ^ St.java:13: Associated declaration From 3b7545f827442cf32d6795c639f624489ad6c50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 8 Oct 2015 19:57:37 +0200 Subject: [PATCH 088/706] Update the JML annotated Java code generated by the vdm2jml tests --- .../AtomicStateInvNoViolation/Entry.java | 3 +- .../atomic/AtomicStateInvNoViolation/St.java | 9 ++-- .../atomic/AtomicStateInvViolation/Entry.java | 4 +- .../atomic/AtomicStateInvViolation/St.java | 9 ++-- .../MaskedRecInvViolated/Entry.java | 34 ++++++++++++-- .../MaskedRecInvViolated/R1.java | 9 ++-- .../MaskedRecInvViolated/R2.java | 5 -- .../MaskedRecInvViolated/R3.java | 9 ++-- .../MaskedRecInvViolated/R4.java | 9 ++-- .../MaskedRecNamedTypeInv/Entry.java | 30 ++++++++++-- .../MaskedRecNamedTypeInv/R1.java | 9 ++-- .../MaskedRecNamedTypeInv/R2.java | 5 -- .../MaskedRecNamedTypeInv/R3.java | 9 ++-- .../MaskedRecNamedTypeInv/R4.java | 9 ++-- .../complexstatedes/ModifyRecInMap/A.java | 8 +--- .../complexstatedes/ModifyRecInMap/B.java | 13 ++++-- .../complexstatedes/ModifyRecInMap/Entry.java | 16 ++++++- .../NamedTypeInvUnionTypeRec/Entry.java | 42 +++++++++++++---- .../NamedTypeInvUnionTypeRec/R1.java | 9 ++-- .../NamedTypeInvUnionTypeRec/R2.java | 10 ---- .../NamedTypeInvUnionTypeRec/R3.java | 9 ++-- .../NamedTypeInvUnionTypeRec/R4.java | 9 ++-- .../NamedTypeInvUnionTypeRec/X.java | 9 ++-- .../RecInRecInAtomic/Entry.java | 30 ++++++++++-- .../complexstatedes/RecInRecInAtomic/R1.java | 9 ++-- .../complexstatedes/RecInRecInAtomic/R2.java | 9 ++-- .../complexstatedes/RecInRecInAtomic/R3.java | 9 ++-- .../RecInRecInvViolation/Entry.java | 46 ++++++++++++++++++- .../RecInRecInvViolation/T1.java | 9 ++-- .../RecInRecInvViolation/T2.java | 9 ++-- .../RecInRecInvViolation/T3.java | 9 ++-- .../RecInRecInvViolation/T4.java | 9 ++-- .../complexstatedes/RecWithMapOfRec/A.java | 8 +--- .../complexstatedes/RecWithMapOfRec/B.java | 13 ++++-- .../RecWithMapOfRec/Entry.java | 10 +++- .../NamedTypeInvLocalDecls/Entry.java | 3 ++ .../NamedTypeInvMapUpdate/Entry.java | 5 ++ .../NamedTypeInvMethodParam/Entry.java | 5 +- .../NamedTypeInvSeqUpdate/Entry.java | 5 ++ .../AssignBoolTypeViolation/Entry.java | 9 ++-- .../FuncReturnTokenViolation/Entry.java | 10 ++-- .../OpParamQuoteTypeViolation/Entry.java | 5 +- .../VarDeclTypeViolation/Entry.java | 14 ++++-- .../prepost/PostCond/Entry.java | 41 +++++++++-------- .../dynamic_analysis/prepost/PostCond/St.java | 9 ++-- .../prepost/PreCond/Entry.java | 30 ++++++------ .../dynamic_analysis/prepost/PreCond/St.java | 9 ++-- .../recinv/RecTypeDefInv/Entry.java | 4 ++ .../recinv/RecTypeDefInv/Rec.java | 18 +++++--- .../recinv/StateInitViolatesInv/St.java | 9 ++-- .../recinv/StateInv/Entry.java | 3 +- .../dynamic_analysis/recinv/StateInv/St.java | 9 ++-- 52 files changed, 438 insertions(+), 198 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java index 6db3365b44..00670057ed 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java @@ -20,8 +20,9 @@ public static Object Run() { Number atomicTmp_1 = 2L; + //@ assert Utils.is_nat(atomicTmp_1); Number atomicTmp_2 = 1L; - + //@ assert Utils.is_nat(atomicTmp_2); { /* Start of atomic statement */ //@ set invChecksOn = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java index ec4e67404a..4682965df1 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java @@ -12,7 +12,10 @@ final public class St implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); public St(final Number _x) { + //@ assert Utils.is_nat(_x); x = _x; + + //@ assert Utils.is_nat(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_1 = x; - //@ assert ret_1 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_1)); return ret_1; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java index 6f10a9935a..1e7e8a652d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java @@ -19,7 +19,7 @@ public static Object Run() { IO.println("Before first atomic (expecting violation after atomic)"); Number atomicTmp_1 = 2L; - + //@ assert Utils.is_nat(atomicTmp_1); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -35,7 +35,7 @@ public static Object Run() { IO.println("Before second atomic"); Number atomicTmp_2 = 1L; - + //@ assert Utils.is_nat(atomicTmp_2); { /* Start of atomic statement */ //@ set invChecksOn = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java index ec4e67404a..4682965df1 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java @@ -12,7 +12,10 @@ final public class St implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); public St(final Number _x) { + //@ assert Utils.is_nat(_x); x = _x; + + //@ assert Utils.is_nat(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_1 = x; - //@ assert ret_1 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_1)); return ret_1; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java index bcbd25b111..7a5a3746b8 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_nat(ignorePattern_2); /* skip */ } @@ -42,12 +42,16 @@ public static Object Run() { public static Number useOk() { project.Entrytypes.R1 r1 = new project.Entrytypes.R1(new project.Entrytypes.R2( new project.Entrytypes.R3(new project.Entrytypes.R4(5L)))); + + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); Number atomicTmp_1 = 10L; + //@ assert Utils.is_int(atomicTmp_1); Number atomicTmp_2 = 3L; + //@ assert Utils.is_int(atomicTmp_2); Number atomicTmp_3 = 5L; - + //@ assert Utils.is_int(atomicTmp_3); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -87,8 +91,14 @@ public static Number useOk() { //@ assert stateDes_1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); + //@ assert r1.valid(); + //@ assert r1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + //@ assert stateDes_6.valid(); //@ assert stateDes_5.valid(); @@ -96,23 +106,32 @@ public static Number useOk() { //@ assert stateDes_4.valid(); + //@ assert stateDes_4.valid(); + //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); + //@ assert stateDes_9.valid(); //@ assert stateDes_8.valid(); //@ assert inv_Entry_T3(stateDes_8); //@ assert stateDes_7.valid(); + + //@ assert stateDes_7.valid(); + //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; + //@ assert Utils.is_nat(ret_1); return ret_1; } public static Number useNotOk() { project.Entrytypes.R1 r1 = new project.Entrytypes.R1(new project.Entrytypes.R2( new project.Entrytypes.R3(new project.Entrytypes.R4(5L)))); - Number atomicTmp_4 = 3L; + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + Number atomicTmp_4 = 3L; + //@ assert Utils.is_int(atomicTmp_4); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -134,10 +153,17 @@ public static Number useNotOk() { //@ assert stateDes_10.valid(); + //@ assert stateDes_10.valid(); + //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); + + //@ assert r1.valid(); + //@ assert r1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; + //@ assert Utils.is_nat(ret_2); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java index cb0226cca0..c76e4acca9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java @@ -12,7 +12,10 @@ final public class R1 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); public R1(final project.Entrytypes.R2 _r2) { + //@ assert Utils.is_(_r2,project.Entrytypes.R2.class); r2 = (_r2 != null) ? Utils.copy(_r2) : null; + + //@ assert Utils.is_(r2,project.Entrytypes.R2.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.R2 get_r2() { project.Entrytypes.R2 ret_3 = r2; - //@ assert ret_3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_3,project.Entrytypes.R2.class)); return ret_3; } public void set_r2(final project.Entrytypes.R2 _r2) { - //@ assert _r2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_r2,project.Entrytypes.R2.class)); r2 = _r2; - //@ assert r2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(r2,project.Entrytypes.R2.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java index 54eeed78f0..e55464a454 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java @@ -12,11 +12,9 @@ final public class R2 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R2(t3); public R2(final project.Entrytypes.R3 _t3) { - //@ assert _t3.valid(); //@ assert inv_Entry_T3(_t3); t3 = (_t3 != null) ? Utils.copy(_t3) : null; - //@ assert t3.valid(); //@ assert inv_Entry_T3(t3); } @@ -50,17 +48,14 @@ public String toString() { public project.Entrytypes.R3 get_t3() { project.Entrytypes.R3 ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> ret_4.valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); return ret_4; } public void set_t3(final project.Entrytypes.R3 _t3) { - //@ assert project.Entry.invChecksOn ==> _t3.valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(_t3)); t3 = _t3; - //@ assert project.Entry.invChecksOn ==> t3.valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(t3)); } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java index d917544456..4ea287a65c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java @@ -12,7 +12,10 @@ final public class R3 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); public R3(final project.Entrytypes.R4 _r4) { + //@ assert Utils.is_(_r4,project.Entrytypes.R4.class); r4 = (_r4 != null) ? Utils.copy(_r4) : null; + + //@ assert Utils.is_(r4,project.Entrytypes.R4.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.R4 get_r4() { project.Entrytypes.R4 ret_5 = r4; - //@ assert ret_5 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_5,project.Entrytypes.R4.class)); return ret_5; } public void set_r4(final project.Entrytypes.R4 _r4) { - //@ assert _r4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_r4,project.Entrytypes.R4.class)); r4 = _r4; - //@ assert r4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(r4,project.Entrytypes.R4.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java index 33b419af2a..58135ba46b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java @@ -12,7 +12,10 @@ final public class R4 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R4(x); public R4(final Number _x) { + //@ assert Utils.is_int(_x); x = _x; + + //@ assert Utils.is_int(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_6 = x; - //@ assert ret_6 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_6)); return ret_6; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java index 073035e4ae..c990e401da 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_nat(ignorePattern_2); /* skip */ } @@ -42,10 +42,13 @@ public static Object Run() { public static Number useOk() { project.Entrytypes.R1 r1 = new project.Entrytypes.R1(new project.Entrytypes.R2( new project.Entrytypes.R3(new project.Entrytypes.R4(5L)))); + + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); Number atomicTmp_1 = 10L; + //@ assert Utils.is_int(atomicTmp_1); Number atomicTmp_2 = 5L; - + //@ assert Utils.is_int(atomicTmp_2); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -76,25 +79,37 @@ public static Number useOk() { //@ assert stateDes_1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); + //@ assert r1.valid(); + //@ assert r1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + //@ assert stateDes_6.valid(); //@ assert stateDes_5.valid(); //@ assert inv_Entry_T3(stateDes_5); //@ assert stateDes_4.valid(); + + //@ assert stateDes_4.valid(); + //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; + //@ assert Utils.is_nat(ret_1); return ret_1; } public static Number useNotOk() { project.Entrytypes.R1 r1 = new project.Entrytypes.R1(new project.Entrytypes.R2( new project.Entrytypes.R3(new project.Entrytypes.R4(5L)))); - Number atomicTmp_3 = 10L; + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + Number atomicTmp_3 = 10L; + //@ assert Utils.is_int(atomicTmp_3); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -116,10 +131,17 @@ public static Number useNotOk() { //@ assert stateDes_7.valid(); + //@ assert stateDes_7.valid(); + //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); + + //@ assert r1.valid(); + //@ assert r1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; + //@ assert Utils.is_nat(ret_2); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java index cb0226cca0..c76e4acca9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java @@ -12,7 +12,10 @@ final public class R1 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); public R1(final project.Entrytypes.R2 _r2) { + //@ assert Utils.is_(_r2,project.Entrytypes.R2.class); r2 = (_r2 != null) ? Utils.copy(_r2) : null; + + //@ assert Utils.is_(r2,project.Entrytypes.R2.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.R2 get_r2() { project.Entrytypes.R2 ret_3 = r2; - //@ assert ret_3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_3,project.Entrytypes.R2.class)); return ret_3; } public void set_r2(final project.Entrytypes.R2 _r2) { - //@ assert _r2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_r2,project.Entrytypes.R2.class)); r2 = _r2; - //@ assert r2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(r2,project.Entrytypes.R2.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java index 54eeed78f0..e55464a454 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java @@ -12,11 +12,9 @@ final public class R2 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R2(t3); public R2(final project.Entrytypes.R3 _t3) { - //@ assert _t3.valid(); //@ assert inv_Entry_T3(_t3); t3 = (_t3 != null) ? Utils.copy(_t3) : null; - //@ assert t3.valid(); //@ assert inv_Entry_T3(t3); } @@ -50,17 +48,14 @@ public String toString() { public project.Entrytypes.R3 get_t3() { project.Entrytypes.R3 ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> ret_4.valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); return ret_4; } public void set_t3(final project.Entrytypes.R3 _t3) { - //@ assert project.Entry.invChecksOn ==> _t3.valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(_t3)); t3 = _t3; - //@ assert project.Entry.invChecksOn ==> t3.valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(t3)); } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java index d917544456..4ea287a65c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java @@ -12,7 +12,10 @@ final public class R3 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); public R3(final project.Entrytypes.R4 _r4) { + //@ assert Utils.is_(_r4,project.Entrytypes.R4.class); r4 = (_r4 != null) ? Utils.copy(_r4) : null; + + //@ assert Utils.is_(r4,project.Entrytypes.R4.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.R4 get_r4() { project.Entrytypes.R4 ret_5 = r4; - //@ assert ret_5 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_5,project.Entrytypes.R4.class)); return ret_5; } public void set_r4(final project.Entrytypes.R4 _r4) { - //@ assert _r4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_r4,project.Entrytypes.R4.class)); r4 = _r4; - //@ assert r4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(r4,project.Entrytypes.R4.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java index 33b419af2a..58135ba46b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java @@ -12,7 +12,10 @@ final public class R4 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R4(x); public R4(final Number _x) { + //@ assert Utils.is_int(_x); x = _x; + + //@ assert Utils.is_int(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_6 = x; - //@ assert ret_6 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_6)); return ret_6; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java index b7e610eacb..9976a5215c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java @@ -43,17 +43,11 @@ public String toString() { /*@ pure @*/ public VDMMap get_m() { - VDMMap ret_3 = m; - - //@ assert ret_3 != null; - return ret_3; + return m; } public void set_m(final VDMMap _m) { - //@ assert _m != null; m = _m; - - //@ assert m != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java index d2a70a3d4f..d036d63a38 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java @@ -11,7 +11,10 @@ final public class B implements Record { public Number x; public B(final Number _x) { + //@ assert Utils.is_nat(_x); x = _x; + + //@ assert Utils.is_nat(x); } /*@ pure @*/ @@ -42,17 +45,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - Number ret_4 = x; + Number ret_3 = x; - //@ assert ret_4 != null; - return ret_4; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_3)); + return ret_3; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java index 7ad76f7d25..eab9683351 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_nat(ignorePattern_2); /* skip */ } @@ -42,6 +42,8 @@ public static Object Run() { public static Number useOk() { project.Entrytypes.A a = new project.Entrytypes.A(MapUtil.map( new Maplet(1L, new project.Entrytypes.B(2L)))); + + //@ assert Utils.is_(a,project.Entrytypes.A.class); VDMMap stateDes_1 = a.get_m(); project.Entrytypes.B stateDes_2 = ((project.Entrytypes.B) Utils.get(stateDes_1, @@ -51,14 +53,20 @@ public static Number useOk() { stateDes_2.set_x(2L); //@ assert a.valid(); + + //@ assert a.valid(); + //@ assert Utils.is_(a,project.Entrytypes.A.class); Number ret_1 = 0L; + //@ assert Utils.is_nat(ret_1); return ret_1; } public static Number useNotOk() { project.Entrytypes.A a = new project.Entrytypes.A(MapUtil.map( new Maplet(1L, new project.Entrytypes.B(2L)))); + + //@ assert Utils.is_(a,project.Entrytypes.A.class); VDMMap stateDes_3 = a.get_m(); project.Entrytypes.B stateDes_4 = ((project.Entrytypes.B) Utils.get(stateDes_3, @@ -68,8 +76,12 @@ public static Number useNotOk() { stateDes_4.set_x(1L); //@ assert a.valid(); + + //@ assert a.valid(); + //@ assert Utils.is_(a,project.Entrytypes.A.class); Number ret_2 = 0L; + //@ assert Utils.is_nat(ret_2); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index b5a3d29283..8c27078d22 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_nat(ignorePattern_2); /* skip */ } @@ -42,12 +42,16 @@ public static Object Run() { public static Number useOk() { project.Entrytypes.R1 r1 = new project.Entrytypes.R1(new project.Entrytypes.R2( new project.Entrytypes.R3(new project.Entrytypes.R4(5L)))); + + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); Number atomicTmp_1 = 10L; + //@ assert Utils.is_int(atomicTmp_1); Number atomicTmp_2 = 3L; + //@ assert Utils.is_int(atomicTmp_2); Number atomicTmp_3 = 5L; - + //@ assert Utils.is_int(atomicTmp_3); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -60,7 +64,7 @@ public static Number useOk() { if (stateDes_2 instanceof project.Entrytypes.R3) { apply_1 = ((project.Entrytypes.R3) stateDes_2).get_r4(); - //@ assert apply_1 != null; + //@ assert Utils.is_(apply_1,project.Entrytypes.R4.class); } else { throw new RuntimeException("Missing member: r4"); } @@ -78,7 +82,7 @@ public static Number useOk() { if (stateDes_5 instanceof project.Entrytypes.R3) { apply_2 = ((project.Entrytypes.R3) stateDes_5).get_r4(); - //@ assert apply_2 != null; + //@ assert Utils.is_(apply_2,project.Entrytypes.R4.class); } else { throw new RuntimeException("Missing member: r4"); } @@ -96,7 +100,7 @@ public static Number useOk() { if (stateDes_8 instanceof project.Entrytypes.R3) { apply_3 = ((project.Entrytypes.R3) stateDes_8).get_r4(); - //@ assert apply_3 != null; + //@ assert Utils.is_(apply_3,project.Entrytypes.R4.class); } else { throw new RuntimeException("Missing member: r4"); } @@ -115,8 +119,14 @@ public static Number useOk() { //@ assert stateDes_1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); + //@ assert r1.valid(); + //@ assert r1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + //@ assert stateDes_6.valid(); //@ assert stateDes_5 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_5).valid(); @@ -125,6 +135,9 @@ public static Number useOk() { //@ assert stateDes_4.valid(); + //@ assert stateDes_4.valid(); + //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); + //@ assert stateDes_9.valid(); //@ assert stateDes_8 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_8).valid(); @@ -132,17 +145,23 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_8); //@ assert stateDes_7.valid(); + + //@ assert stateDes_7.valid(); + //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; + //@ assert Utils.is_nat(ret_1); return ret_1; } public static Number useNotOk() { project.Entrytypes.R1 r1 = new project.Entrytypes.R1(new project.Entrytypes.R2( new project.Entrytypes.R3(new project.Entrytypes.R4(5L)))); - Number atomicTmp_4 = 3L; + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + Number atomicTmp_4 = 3L; + //@ assert Utils.is_int(atomicTmp_4); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -155,7 +174,7 @@ public static Number useNotOk() { if (stateDes_11 instanceof project.Entrytypes.R3) { apply_4 = ((project.Entrytypes.R3) stateDes_11).get_r4(); - //@ assert apply_4 != null; + //@ assert Utils.is_(apply_4,project.Entrytypes.R4.class); } else { throw new RuntimeException("Missing member: r4"); } @@ -174,10 +193,17 @@ public static Number useNotOk() { //@ assert stateDes_10.valid(); + //@ assert stateDes_10.valid(); + //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); + + //@ assert r1.valid(); + //@ assert r1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; + //@ assert Utils.is_nat(ret_2); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java index caacb3a69a..cfe0a301d3 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java @@ -12,7 +12,10 @@ final public class R1 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); public R1(final project.Entrytypes.R2 _r2) { + //@ assert Utils.is_(_r2,project.Entrytypes.R2.class); r2 = (_r2 != null) ? Utils.copy(_r2) : null; + + //@ assert Utils.is_(r2,project.Entrytypes.R2.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.R2 get_r2() { project.Entrytypes.R2 ret_3 = r2; - //@ assert ret_3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_3,project.Entrytypes.R2.class)); return ret_3; } public void set_r2(final project.Entrytypes.R2 _r2) { - //@ assert _r2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_r2,project.Entrytypes.R2.class)); r2 = _r2; - //@ assert r2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(r2,project.Entrytypes.R2.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java index 9ca122fee8..ac06ab73a7 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java @@ -12,13 +12,9 @@ final public class R2 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R2(t3); public R2(final Object _t3) { - //@ assert _t3 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) _t3).valid(); - //@ assert _t3 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) _t3).valid(); //@ assert inv_Entry_T3(_t3); t3 = (_t3 != null) ? _t3 : null; - //@ assert t3 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) t3).valid(); - //@ assert t3 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) t3).valid(); //@ assert inv_Entry_T3(t3); } @@ -52,20 +48,14 @@ public String toString() { public Object get_t3() { Object ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> ret_4 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) ret_4).valid(); - //@ assert project.Entry.invChecksOn ==> ret_4 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) ret_4).valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); return ret_4; } public void set_t3(final Object _t3) { - //@ assert project.Entry.invChecksOn ==> _t3 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) _t3).valid(); - //@ assert project.Entry.invChecksOn ==> _t3 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) _t3).valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(_t3)); t3 = _t3; - //@ assert project.Entry.invChecksOn ==> t3 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) t3).valid(); - //@ assert project.Entry.invChecksOn ==> t3 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) t3).valid(); //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(t3)); } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java index 240415c866..092d8b41cd 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java @@ -12,7 +12,10 @@ final public class R3 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); public R3(final project.Entrytypes.R4 _r4) { + //@ assert Utils.is_(_r4,project.Entrytypes.R4.class); r4 = (_r4 != null) ? Utils.copy(_r4) : null; + + //@ assert Utils.is_(r4,project.Entrytypes.R4.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.R4 get_r4() { project.Entrytypes.R4 ret_5 = r4; - //@ assert ret_5 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_5,project.Entrytypes.R4.class)); return ret_5; } public void set_r4(final project.Entrytypes.R4 _r4) { - //@ assert _r4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_r4,project.Entrytypes.R4.class)); r4 = _r4; - //@ assert r4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(r4,project.Entrytypes.R4.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java index cf543111c2..767d9ef379 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java @@ -12,7 +12,10 @@ final public class R4 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R4(x); public R4(final Number _x) { + //@ assert Utils.is_int(_x); x = _x; + + //@ assert Utils.is_int(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_6 = x; - //@ assert ret_6 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_6)); return ret_6; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java index 820fdc351e..f7199c0d50 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java @@ -11,7 +11,10 @@ final public class X implements Record { public Boolean b; public X(final Boolean _b) { + //@ assert Utils.is_bool(_b); b = _b; + + //@ assert Utils.is_bool(b); } /*@ pure @*/ @@ -44,15 +47,15 @@ public String toString() { public Boolean get_b() { Boolean ret_7 = b; - //@ assert ret_7 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_bool(ret_7)); return ret_7; } public void set_b(final Boolean _b) { - //@ assert _b != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_bool(_b)); b = _b; - //@ assert b != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_bool(b)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java index 3e9df3cbde..862d32b2fe 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_nat(ignorePattern_2); /* skip */ } @@ -42,10 +42,13 @@ public static Object Run() { public static Number useOk() { project.Entrytypes.R1 r1 = new project.Entrytypes.R1(new project.Entrytypes.R2( new project.Entrytypes.R3(5L))); + + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); Number atomicTmp_1 = 1L; + //@ assert Utils.is_int(atomicTmp_1); Number atomicTmp_2 = 5L; - + //@ assert Utils.is_int(atomicTmp_2); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -69,22 +72,34 @@ public static Number useOk() { //@ assert stateDes_1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); + //@ assert r1.valid(); + //@ assert r1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + //@ assert stateDes_4.valid(); //@ assert stateDes_3.valid(); + + //@ assert stateDes_3.valid(); + //@ assert Utils.is_(stateDes_3,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; + //@ assert Utils.is_nat(ret_1); return ret_1; } public static Number useNotOk() { project.Entrytypes.R1 r1 = new project.Entrytypes.R1(new project.Entrytypes.R2( new project.Entrytypes.R3(5L))); - Number atomicTmp_3 = 1L; + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + Number atomicTmp_3 = 1L; + //@ assert Utils.is_int(atomicTmp_3); { /* Start of atomic statement */ //@ set invChecksOn = false; @@ -101,10 +116,17 @@ public static Number useNotOk() { //@ assert stateDes_5.valid(); + //@ assert stateDes_5.valid(); + //@ assert Utils.is_(stateDes_5,project.Entrytypes.R2.class); + + //@ assert r1.valid(); + //@ assert r1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; + //@ assert Utils.is_nat(ret_2); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java index 5034b5bfe5..a3f778da25 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java @@ -12,7 +12,10 @@ final public class R1 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); public R1(final project.Entrytypes.R2 _r2) { + //@ assert Utils.is_(_r2,project.Entrytypes.R2.class); r2 = (_r2 != null) ? Utils.copy(_r2) : null; + + //@ assert Utils.is_(r2,project.Entrytypes.R2.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.R2 get_r2() { project.Entrytypes.R2 ret_3 = r2; - //@ assert ret_3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_3,project.Entrytypes.R2.class)); return ret_3; } public void set_r2(final project.Entrytypes.R2 _r2) { - //@ assert _r2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_r2,project.Entrytypes.R2.class)); r2 = _r2; - //@ assert r2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(r2,project.Entrytypes.R2.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java index 1ccd32ebe4..10004666da 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java @@ -12,7 +12,10 @@ final public class R2 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R2(r3); public R2(final project.Entrytypes.R3 _r3) { + //@ assert Utils.is_(_r3,project.Entrytypes.R3.class); r3 = (_r3 != null) ? Utils.copy(_r3) : null; + + //@ assert Utils.is_(r3,project.Entrytypes.R3.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.R3 get_r3() { project.Entrytypes.R3 ret_4 = r3; - //@ assert ret_4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_4,project.Entrytypes.R3.class)); return ret_4; } public void set_r3(final project.Entrytypes.R3 _r3) { - //@ assert _r3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_r3,project.Entrytypes.R3.class)); r3 = _r3; - //@ assert r3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(r3,project.Entrytypes.R3.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java index 673a576cb2..04117836da 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java @@ -12,7 +12,10 @@ final public class R3 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(x); public R3(final Number _x) { + //@ assert Utils.is_int(_x); x = _x; + + //@ assert Utils.is_int(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_5 = x; - //@ assert ret_5 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_5)); return ret_5; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java index 83d5849c07..0be19ac7b1 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java @@ -15,6 +15,8 @@ private Entry() { public static Number useOk() { project.Entrytypes.T1 t1 = new project.Entrytypes.T1(new project.Entrytypes.T2( new project.Entrytypes.T3(new project.Entrytypes.T4(5L)))); + + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); project.Entrytypes.T2 stateDes_1 = t1.get_t2(); project.Entrytypes.T3 stateDes_2 = stateDes_1.get_t3(); @@ -26,9 +28,18 @@ public static Number useOk() { //@ assert stateDes_2.valid(); + //@ assert stateDes_2.valid(); + //@ assert Utils.is_(stateDes_2,project.Entrytypes.T3.class); + //@ assert stateDes_1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.T2.class); + + //@ assert t1.valid(); + //@ assert t1.valid(); + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); project.Entrytypes.T2 stateDes_4 = t1.get_t2(); project.Entrytypes.T3 stateDes_5 = stateDes_4.get_t3(); @@ -40,17 +51,29 @@ public static Number useOk() { //@ assert stateDes_5.valid(); + //@ assert stateDes_5.valid(); + //@ assert Utils.is_(stateDes_5,project.Entrytypes.T3.class); + + //@ assert stateDes_4.valid(); + //@ assert stateDes_4.valid(); + //@ assert Utils.is_(stateDes_4,project.Entrytypes.T2.class); + + //@ assert t1.valid(); //@ assert t1.valid(); + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); Number ret_1 = 0L; + //@ assert Utils.is_nat(ret_1); return ret_1; } public static Number useNotOk() { project.Entrytypes.T1 t1 = new project.Entrytypes.T1(new project.Entrytypes.T2( new project.Entrytypes.T3(new project.Entrytypes.T4(5L)))); + + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); project.Entrytypes.T2 stateDes_7 = t1.get_t2(); project.Entrytypes.T3 stateDes_8 = stateDes_7.get_t3(); @@ -62,9 +85,18 @@ public static Number useNotOk() { //@ assert stateDes_8.valid(); + //@ assert stateDes_8.valid(); + //@ assert Utils.is_(stateDes_8,project.Entrytypes.T3.class); + //@ assert stateDes_7.valid(); + //@ assert stateDes_7.valid(); + //@ assert Utils.is_(stateDes_7,project.Entrytypes.T2.class); + + //@ assert t1.valid(); + //@ assert t1.valid(); + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); project.Entrytypes.T2 stateDes_10 = t1.get_t2(); project.Entrytypes.T3 stateDes_11 = stateDes_10.get_t3(); @@ -76,11 +108,21 @@ public static Number useNotOk() { //@ assert stateDes_11.valid(); + //@ assert stateDes_11.valid(); + //@ assert Utils.is_(stateDes_11,project.Entrytypes.T3.class); + + //@ assert stateDes_10.valid(); + //@ assert stateDes_10.valid(); + //@ assert Utils.is_(stateDes_10,project.Entrytypes.T2.class); + + //@ assert t1.valid(); //@ assert t1.valid(); + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); Number ret_2 = 0L; + //@ assert Utils.is_nat(ret_2); return ret_2; } @@ -90,7 +132,7 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); /* skip */ } @@ -101,7 +143,7 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_nat(ignorePattern_2); /* skip */ } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java index 5e910be993..33008b4937 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java @@ -12,7 +12,10 @@ final public class T1 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_T1(t2); public T1(final project.Entrytypes.T2 _t2) { + //@ assert Utils.is_(_t2,project.Entrytypes.T2.class); t2 = (_t2 != null) ? Utils.copy(_t2) : null; + + //@ assert Utils.is_(t2,project.Entrytypes.T2.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.T2 get_t2() { project.Entrytypes.T2 ret_3 = t2; - //@ assert ret_3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_3,project.Entrytypes.T2.class)); return ret_3; } public void set_t2(final project.Entrytypes.T2 _t2) { - //@ assert _t2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_t2,project.Entrytypes.T2.class)); t2 = _t2; - //@ assert t2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(t2,project.Entrytypes.T2.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java index b7b77e1615..77dd63304c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java @@ -12,7 +12,10 @@ final public class T2 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); public T2(final project.Entrytypes.T3 _t3) { + //@ assert Utils.is_(_t3,project.Entrytypes.T3.class); t3 = (_t3 != null) ? Utils.copy(_t3) : null; + + //@ assert Utils.is_(t3,project.Entrytypes.T3.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.T3 get_t3() { project.Entrytypes.T3 ret_4 = t3; - //@ assert ret_4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_4,project.Entrytypes.T3.class)); return ret_4; } public void set_t3(final project.Entrytypes.T3 _t3) { - //@ assert _t3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_t3,project.Entrytypes.T3.class)); t3 = _t3; - //@ assert t3 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(t3,project.Entrytypes.T3.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java index 810c159928..3523eedb78 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java @@ -12,7 +12,10 @@ final public class T3 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_T3(t4); public T3(final project.Entrytypes.T4 _t4) { + //@ assert Utils.is_(_t4,project.Entrytypes.T4.class); t4 = (_t4 != null) ? Utils.copy(_t4) : null; + + //@ assert Utils.is_(t4,project.Entrytypes.T4.class); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public project.Entrytypes.T4 get_t4() { project.Entrytypes.T4 ret_5 = t4; - //@ assert ret_5 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(ret_5,project.Entrytypes.T4.class)); return ret_5; } public void set_t4(final project.Entrytypes.T4 _t4) { - //@ assert _t4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(_t4,project.Entrytypes.T4.class)); t4 = _t4; - //@ assert t4 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_(t4,project.Entrytypes.T4.class)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java index aced32dcd4..a1e1ba1d4b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java @@ -12,7 +12,10 @@ final public class T4 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_T4(x); public T4(final Number _x) { + //@ assert Utils.is_nat(_x); x = _x; + + //@ assert Utils.is_nat(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_6 = x; - //@ assert ret_6 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_6)); return ret_6; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java index b7e610eacb..9976a5215c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java @@ -43,17 +43,11 @@ public String toString() { /*@ pure @*/ public VDMMap get_m() { - VDMMap ret_3 = m; - - //@ assert ret_3 != null; - return ret_3; + return m; } public void set_m(final VDMMap _m) { - //@ assert _m != null; m = _m; - - //@ assert m != null; } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java index d2a70a3d4f..d036d63a38 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java @@ -11,7 +11,10 @@ final public class B implements Record { public Number x; public B(final Number _x) { + //@ assert Utils.is_nat(_x); x = _x; + + //@ assert Utils.is_nat(x); } /*@ pure @*/ @@ -42,17 +45,17 @@ public String toString() { /*@ pure @*/ public Number get_x() { - Number ret_4 = x; + Number ret_3 = x; - //@ assert ret_4 != null; - return ret_4; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_3)); + return ret_3; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java index 599dc80584..14720605e6 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Number ignorePattern_1 = useOk(); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Number ignorePattern_2 = useNotOk(); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_nat(ignorePattern_2); /* skip */ } @@ -41,23 +41,29 @@ public static Object Run() { public static Number useOk() { project.Entrytypes.A a = new project.Entrytypes.A(MapUtil.map()); + //@ assert Utils.is_(a,project.Entrytypes.A.class); + //@ assert a != null; a.set_m(MapUtil.munion(Utils.copy(a.get_m()), MapUtil.map(new Maplet(1L, new project.Entrytypes.B(2L))))); Number ret_1 = 0L; + //@ assert Utils.is_nat(ret_1); return ret_1; } public static Number useNotOk() { project.Entrytypes.A a = new project.Entrytypes.A(MapUtil.map()); + //@ assert Utils.is_(a,project.Entrytypes.A.class); + //@ assert a != null; a.set_m(MapUtil.munion(Utils.copy(a.get_m()), MapUtil.map(new Maplet(1L, new project.Entrytypes.B(1L))))); Number ret_2 = 0L; + //@ assert Utils.is_nat(ret_2); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java index 2ccf3b8fac..5b6a6f054e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java @@ -15,11 +15,14 @@ private Entry() { public static void typeUseOk() { Number ignorePattern_1 = 1L; + //@ assert Utils.is_nat1(ignorePattern_1); Object even = 2L; //@ assert inv_Entry_No(even) && (inv_Entry_Even(even) || inv_Entry_Large(even)); Number ignorePattern_2 = 3L; + //@ assert Utils.is_nat1(ignorePattern_2); + /* skip */ } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java index cbdc41f810..671761f789 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java @@ -15,11 +15,16 @@ private Entry() { public static Object Run() { VDMMap m = MapUtil.map(new Maplet('a', 1L), new Maplet(1L, 2L)); //@ assert inv_Entry_M(m); + + //@ assert m != null; Utils.mapSeqUpdate(m, 'a', 2L); //@ assert inv_Entry_M(m); + + //@ assert m != null; Utils.mapSeqUpdate(m, 1L, 2L); //@ assert inv_Entry_M(m); IO.println("Breaking named type invariant for sequence"); + //@ assert m != null; Utils.mapSeqUpdate(m, 2L, 10L); //@ assert inv_Entry_M(m); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java index ab879a975f..19d487884b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java @@ -15,8 +15,9 @@ private Entry() { public static Object Run() { Number n1 = 2L; + //@ assert Utils.is_nat1(n1); Number n2 = 3L; - + //@ assert Utils.is_nat1(n2); { { Number ignorePattern_1 = op(n1, 5L, n1); @@ -43,7 +44,7 @@ public static Object Run() { public static Number op(final Number a, final Number b, final Number c) { //@ assert inv_Entry_Even(a); - //@ assert b != null; + //@ assert Utils.is_nat(b); //@ assert inv_Entry_Even(c); Number ret_1 = b.longValue() * (a.longValue() + c.longValue()); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java index 1e55786401..c83a686fef 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java @@ -15,11 +15,16 @@ private Entry() { public static Object Run() { VDMSeq s = SeqUtil.seq(10L, 11L, 12L); //@ assert inv_Entry_S(s); + + //@ assert s != null; Utils.mapSeqUpdate(s, 1L, 'a'); //@ assert inv_Entry_S(s); + + //@ assert s != null; Utils.mapSeqUpdate(s, 2L, null); //@ assert inv_Entry_S(s); IO.println("Breaking named type invariant for sequence"); + //@ assert s != null; Utils.mapSeqUpdate(s, 3L, 4L); //@ assert inv_Entry_S(s); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java index 99a4e351cf..0d1a5d0c2c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java @@ -15,17 +15,20 @@ private Entry() { public static Object Run() { Boolean b = true; + //@ assert Utils.is_bool(b); Boolean bOpt = null; - + //@ assert (bOpt == null || Utils.is_bool(bOpt)); IO.println("Before doing valid assignments"); bOpt = true; + //@ assert (bOpt == null || Utils.is_bool(bOpt)); b = bOpt; - //@ assert b != null; + //@ assert Utils.is_bool(b); bOpt = null; + //@ assert (bOpt == null || Utils.is_bool(bOpt)); IO.println("After doing valid assignments"); IO.println("Before doing illegal assignments"); b = bOpt; - //@ assert b != null; + //@ assert Utils.is_bool(b); IO.println("After doing illegal assignments"); return true; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java index b923f6e159..d137001d93 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Token ignorePattern_1 = ok(); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_token(ignorePattern_1); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Token ignorePattern_2 = err(); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_token(ignorePattern_2); /* skip */ } @@ -43,9 +43,10 @@ public static Object Run() { public static Token ok() { Token aOpt = new Token(""); + //@ assert (aOpt == null || Utils.is_token(aOpt)); Token ret_1 = aOpt; - //@ assert ret_1 != null; + //@ assert Utils.is_token(ret_1); return ret_1; } @@ -53,9 +54,10 @@ public static Token ok() { public static Token err() { Token aOpt = null; + //@ assert (aOpt == null || Utils.is_token(aOpt)); Token ret_2 = aOpt; - //@ assert ret_2 != null; + //@ assert Utils.is_token(ret_2); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java index ec54b1eef0..1c004061f0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java @@ -15,8 +15,9 @@ private Entry() { public static Object Run() { project.quotes.AQuote aOpt = null; + //@ assert (aOpt == null || Utils.is_(aOpt,project.quotes.AQuote.class)); project.quotes.AQuote a = project.quotes.AQuote.getInstance(); - + //@ assert Utils.is_(a,project.quotes.AQuote.class); { IO.println("Before passing LEGAL value"); op(a); @@ -30,7 +31,7 @@ public static Object Run() { } public static void op(final project.quotes.AQuote ignorePattern_1) { - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_(ignorePattern_1,project.quotes.AQuote.class); /* skip */ } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java index 1445108f3a..d47ef655a7 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Number bOkay = natOne(); - //@ assert bOkay != null; + //@ assert Utils.is_nat(bOkay); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Number bError = natNil(); - //@ assert bError != null; + //@ assert Utils.is_nat(bError); /* skip */ } @@ -41,12 +41,18 @@ public static Object Run() { /*@ pure @*/ public static Number natNil() { - return null; + Number ret_1 = null; + + //@ assert (ret_1 == null || Utils.is_nat(ret_1)); + return ret_1; } /*@ pure @*/ public static Number natOne() { - return 1L; + Number ret_2 = 1L; + + //@ assert (ret_2 == null || Utils.is_nat(ret_2)); + return ret_2; } public String toString() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java index dd63b8f904..e4f492aa23 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java @@ -18,9 +18,9 @@ private Entry() { public static Object Run() { Number ignorePattern_1 = opRet(1L); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); Number ignorePattern_2 = f(3L); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_nat(ignorePattern_2); { opVoid(); IO.println("Before breaking post condition"); @@ -28,7 +28,7 @@ public static Object Run() { { Number ignorePattern_3 = opRet(4L); - //@ assert ignorePattern_3 != null; + //@ assert Utils.is_nat(ignorePattern_3); /* skip */ } @@ -47,30 +47,30 @@ public static void opVoid() { //@ ensures post_opRet(a,\result,\old(St.copy()),St); public static Number opRet(final Number a) { - //@ assert a != null; + //@ assert Utils.is_nat(a); //@ assert St != null; St.set_x(St.get_x().longValue() + 1L); Number ret_1 = St.get_x(); - //@ assert ret_1 != null; + //@ assert Utils.is_nat(ret_1); return ret_1; } //@ ensures post_f(a,\result); /*@ pure @*/ public static Number f(final Number a) { - //@ assert a != null; + //@ assert Utils.is_nat(a); if (Utils.equals(Utils.mod(a.longValue(), 2L), 0L)) { Number ret_2 = a.longValue() + 2L; - //@ assert ret_2 != null; + //@ assert Utils.is_nat(ret_2); return ret_2; } else { Number ret_3 = a.longValue() + 1L; - //@ assert ret_3 != null; + //@ assert Utils.is_nat(ret_3); return ret_3; } } @@ -78,47 +78,50 @@ public static Number f(final Number a) { /*@ pure @*/ public static Boolean post_opVoid(final project.Entrytypes.St _St, final project.Entrytypes.St St) { - //@ assert _St != null; + //@ assert Utils.is_(_St,project.Entrytypes.St.class); - //@ assert St != null; + //@ assert Utils.is_(St,project.Entrytypes.St.class); Boolean ret_4 = Utils.equals(St.get_x(), _St.get_x().longValue() + 1L); - //@ assert ret_4 != null; + //@ assert Utils.is_bool(ret_4); return ret_4; } /*@ pure @*/ public static Boolean post_opRet(final Number a, final Number RESULT, final project.Entrytypes.St _St, final project.Entrytypes.St St) { - //@ assert a != null; + //@ assert Utils.is_nat(a); - //@ assert RESULT != null; + //@ assert Utils.is_nat(RESULT); - //@ assert _St != null; + //@ assert Utils.is_(_St,project.Entrytypes.St.class); - //@ assert St != null; + //@ assert Utils.is_(St,project.Entrytypes.St.class); Boolean andResult_1 = false; + //@ assert Utils.is_bool(andResult_1); if (Utils.equals(St.get_x(), _St.get_x().longValue() + 1L)) { if (Utils.equals(RESULT, a)) { andResult_1 = true; + + //@ assert Utils.is_bool(andResult_1); } } Boolean ret_5 = andResult_1; - //@ assert ret_5 != null; + //@ assert Utils.is_bool(ret_5); return ret_5; } /*@ pure @*/ public static Boolean post_f(final Number a, final Number RESULT) { - //@ assert a != null; + //@ assert Utils.is_nat(a); - //@ assert RESULT != null; + //@ assert Utils.is_nat(RESULT); Boolean ret_6 = Utils.equals(Utils.mod(RESULT.longValue(), 2L), 0L); - //@ assert ret_6 != null; + //@ assert Utils.is_bool(ret_6); return ret_6; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java index 6990802b88..56744ad1ab 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java @@ -11,7 +11,10 @@ final public class St implements Record { public Number x; public St(final Number _x) { + //@ assert Utils.is_nat(_x); x = _x; + + //@ assert Utils.is_nat(x); } /*@ pure @*/ @@ -44,15 +47,15 @@ public String toString() { public Number get_x() { Number ret_7 = x; - //@ assert ret_7 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_7)); return ret_7; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java index 6718208b15..b674311072 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java @@ -17,7 +17,7 @@ private Entry() { public static Object Run() { Number ignorePattern_1 = opRet(1L); - //@ assert ignorePattern_1 != null; + //@ assert Utils.is_nat(ignorePattern_1); { opVoid(2L); IO.println("Before breaking pre condition"); @@ -25,7 +25,7 @@ public static Object Run() { { Number ignorePattern_2 = id(-1L); - //@ assert ignorePattern_2 != null; + //@ assert Utils.is_int(ignorePattern_2); /* skip */ } @@ -38,20 +38,20 @@ public static Object Run() { //@ requires pre_opRet(a,St); public static Number opRet(final Number a) { - //@ assert a != null; + //@ assert Utils.is_nat(a); //@ assert St != null; St.set_x(a.longValue() + 1L); Number ret_1 = St.get_x(); - //@ assert ret_1 != null; + //@ assert Utils.is_nat(ret_1); return ret_1; } //@ requires pre_opVoid(a,St); public static void opVoid(final Number a) { - //@ assert a != null; + //@ assert Utils.is_nat(a); //@ assert St != null; St.set_x(a.longValue() + 1L); @@ -60,43 +60,43 @@ public static void opVoid(final Number a) { //@ requires pre_id(a); /*@ pure @*/ public static Number id(final Number a) { - //@ assert a != null; + //@ assert Utils.is_int(a); Number ret_2 = a; - //@ assert ret_2 != null; + //@ assert Utils.is_int(ret_2); return ret_2; } /*@ pure @*/ public static Boolean pre_opRet(final Number a, final project.Entrytypes.St St) { - //@ assert a != null; + //@ assert Utils.is_nat(a); - //@ assert St != null; + //@ assert Utils.is_(St,project.Entrytypes.St.class); Boolean ret_3 = St.get_x().longValue() > 0L; - //@ assert ret_3 != null; + //@ assert Utils.is_bool(ret_3); return ret_3; } /*@ pure @*/ public static Boolean pre_opVoid(final Number a, final project.Entrytypes.St St) { - //@ assert a != null; + //@ assert Utils.is_nat(a); - //@ assert St != null; + //@ assert Utils.is_(St,project.Entrytypes.St.class); Boolean ret_4 = St.get_x().longValue() > 0L; - //@ assert ret_4 != null; + //@ assert Utils.is_bool(ret_4); return ret_4; } /*@ pure @*/ public static Boolean pre_id(final Number a) { - //@ assert a != null; + //@ assert Utils.is_int(a); Boolean ret_5 = a.longValue() > 0L; - //@ assert ret_5 != null; + //@ assert Utils.is_bool(ret_5); return ret_5; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java index 725e408144..bb677b0e7d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java @@ -11,7 +11,10 @@ final public class St implements Record { public Number x; public St(final Number _x) { + //@ assert Utils.is_nat(_x); x = _x; + + //@ assert Utils.is_nat(x); } /*@ pure @*/ @@ -44,15 +47,15 @@ public String toString() { public Number get_x() { Number ret_6 = x; - //@ assert ret_6 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_6)); return ret_6; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java index 40906738f8..8954eaf64c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java @@ -25,6 +25,8 @@ public static void recInvOk() { project.Entrytypes.Rec ignorePattern_1 = new project.Entrytypes.Rec(1L, 2L); + //@ assert Utils.is_(ignorePattern_1,project.Entrytypes.Rec.class); + /* skip */ } @@ -32,6 +34,8 @@ public static void recInvBreak() { project.Entrytypes.Rec ignorePattern_2 = new project.Entrytypes.Rec(1L, -2L); + //@ assert Utils.is_(ignorePattern_2,project.Entrytypes.Rec.class); + /* skip */ } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java index 11907f92ed..e1187a1c8e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java @@ -13,8 +13,14 @@ final public class Rec implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_Rec(x,y); public Rec(final Number _x, final Number _y) { + //@ assert Utils.is_int(_x); + + //@ assert Utils.is_int(_y); x = _x; + //@ assert Utils.is_int(x); y = _y; + + //@ assert Utils.is_int(y); } /*@ pure @*/ @@ -47,30 +53,30 @@ public String toString() { public Number get_x() { Number ret_1 = x; - //@ assert ret_1 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_1)); return ret_1; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); } /*@ pure @*/ public Number get_y() { Number ret_2 = y; - //@ assert ret_2 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_2)); return ret_2; } public void set_y(final Number _y) { - //@ assert _y != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_y)); y = _y; - //@ assert y != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(y)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java index 031b91e7c0..bde4a8a6a9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java @@ -12,7 +12,10 @@ final public class St implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); public St(final Number _x) { + //@ assert Utils.is_int(_x); x = _x; + + //@ assert Utils.is_int(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_1 = x; - //@ assert ret_1 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_1)); return ret_1; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java index d0483b9854..c499846552 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java @@ -27,8 +27,9 @@ public static Object Run() { public static void opAtomic() { Number atomicTmp_1 = -1L; + //@ assert Utils.is_int(atomicTmp_1); Number atomicTmp_2 = 1L; - + //@ assert Utils.is_int(atomicTmp_2); { /* Start of atomic statement */ //@ set invChecksOn = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java index 031b91e7c0..bde4a8a6a9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java @@ -12,7 +12,10 @@ final public class St implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); public St(final Number _x) { + //@ assert Utils.is_int(_x); x = _x; + + //@ assert Utils.is_int(x); } /*@ pure @*/ @@ -45,15 +48,15 @@ public String toString() { public Number get_x() { Number ret_1 = x; - //@ assert ret_1 != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_1)); return ret_1; } public void set_x(final Number _x) { - //@ assert _x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); x = _x; - //@ assert x != null; + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); } /*@ pure @*/ From 7177a6d5105b60bc811f62abca2c9766e9bdff23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 00:45:05 +0200 Subject: [PATCH 089/706] Update test to reveal a bug with handling of sequence conversion --- .../string_specs/SeqConversion.vdmpp | 16 +++++++++- .../string_specs/SeqConversion.vdmpp.result | 30 ++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp b/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp index 2d92a5ed67..b6af2fcfc5 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp +++ b/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp @@ -61,8 +61,22 @@ if 1 = 1 then else return "b"; +functions + +op8 : ? -> seq of char +op8(a) == +cases a: + -> + if true then + "" + else + undefined +end + +operations + public static Run : () ==> seq of char Run () == - return x ^ f() ^ op1() ^ op2() ^ op3() ^ op5() ^ op6() ^ op7();-- ^ op4(); + return x ^ f() ^ op1() ^ op2() ^ op3() ^ op5() ^ op6() ^ op7() ^ op8();-- ^ op4(); end Entry \ No newline at end of file diff --git a/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp.result index b5c64f0a96..79770353f3 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp.result @@ -68,7 +68,8 @@ public class Entry { public static String Run() { return SeqUtil.toStr(Utils.copy(x)) + f() + op1() + op2() + op3() + - op5() + SeqUtil.toStr(op6()) + op7(); + op5() + SeqUtil.toStr(op6()) + op7() + + op8(quotes.AQuote.getInstance()); } public static String f() { @@ -79,9 +80,36 @@ public class Entry { } } + private static String op8(final Object a) { + VDMSeq casesExpResult_1 = null; + + Object quotePattern_1 = a; + Boolean success_1 = Utils.equals(quotePattern_1, + quotes.AQuote.getInstance()); + + if (success_1) { + VDMSeq ternaryIfExp_1 = null; + + if (true) { + ternaryIfExp_1 = SeqUtil.toSeq(""); + } else { + ternaryIfExp_1 = null; + } + + casesExpResult_1 = Utils.copy(ternaryIfExp_1); + } else { + throw new RuntimeException("Quote pattern match failed"); + } + + return SeqUtil.toStr(Utils.copy(casesExpResult_1)); + } + public String toString() { return "Entry{" + "x = " + Utils.toString(x) + "}"; } } ########## +*Quotes* +A +########## From 9c638874b75294de29e23f7e1e0fca5bd6ded606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 00:45:44 +0200 Subject: [PATCH 090/706] Missing case of sequence conversion --- .../java/org/overture/codegen/trans/SeqConvTrans.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/SeqConvTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/SeqConvTrans.java index b44e0bdc96..ee885f2dca 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/SeqConvTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/SeqConvTrans.java @@ -13,6 +13,7 @@ import org.overture.codegen.cgast.expressions.ASeqToStringUnaryExpCG; import org.overture.codegen.cgast.expressions.AStringToSeqUnaryExpCG; import org.overture.codegen.cgast.expressions.SBinaryExpCG; +import org.overture.codegen.cgast.statements.AAssignToExpStmCG; import org.overture.codegen.cgast.statements.AReturnStmCG; import org.overture.codegen.cgast.types.AMethodTypeCG; import org.overture.codegen.cgast.types.AStringTypeCG; @@ -77,6 +78,16 @@ public void inAVarDeclCG(AVarDeclCG node) handleExp(exp, nodeType); } + + @Override + public void caseAAssignToExpStmCG(AAssignToExpStmCG node) throws AnalysisException + { + if(node.getExp() != null) + { + node.getExp().apply(this); + handleExp(node.getExp(), node.getTarget().getType()); + } + } private void handleExp(SExpCG exp, STypeCG nodeType) { From 06f1ee918e586b1f251ae1736f272f7b684545e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 00:50:35 +0200 Subject: [PATCH 091/706] Fix: missing registration of quote value when encountering a qoute pattern --- .../java/org/overture/codegen/visitor/PatternVisitorCG.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/PatternVisitorCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/PatternVisitorCG.java index c4774660d0..7ec7a7083e 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/PatternVisitorCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/PatternVisitorCG.java @@ -119,10 +119,11 @@ public SPatternCG caseAQuotePattern(AQuotePattern node, IRInfo question) throws AnalysisException { String value = node.getValue().getValue(); - + AQuotePatternCG quotePatternCg = new AQuotePatternCG(); quotePatternCg.setValue(value); + question.registerQuoteValue(value); return quotePatternCg; } From 46849cfd583895b1c21c19e3ee6ba40b544fc782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 00:51:59 +0200 Subject: [PATCH 092/706] Fix for type equality check in the recursive type handler --- .../CGVisitorRecursiveTypeHandler.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/CGVisitorRecursiveTypeHandler.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/CGVisitorRecursiveTypeHandler.java index 2f9d05d0c2..a59307d2ee 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/CGVisitorRecursiveTypeHandler.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/CGVisitorRecursiveTypeHandler.java @@ -4,6 +4,7 @@ import org.overture.ast.analysis.AnalysisException; import org.overture.ast.node.INode; +import org.overture.ast.types.AUnknownType; import org.overture.ast.types.PType; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.types.AObjectTypeCG; @@ -46,7 +47,33 @@ private boolean contains(PType type, IRInfo question) { for (PType e : typeStack) { - if (question.getTcFactory().createPTypeAssistant().equals(type, e) + // Everything equals the unknown type according to the type equality + // checker so we give unknown types special treatment + if(type instanceof AUnknownType) + { + if(e instanceof AUnknownType) + { + return true; + } + else + { + return false; + } + } + else if(e instanceof AUnknownType) + { + if(type instanceof AUnknownType) + { + return true; + } + else + { + return false; + } + } + // Now that we are sure that none of them are unknown types we use + // the type equality checker + else if (question.getTcFactory().createPTypeAssistant().equals(type, e) && question.getTcFactory().createPTypeAssistant().equals(e, type)) { return true; From 40e7d33f2cf2b0f987ca3c25e5956ede8f51646d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 11:39:17 +0200 Subject: [PATCH 093/706] Expect redundant validity checks to go out --- .../MaskedRecInvViolated/Entry.java | 6 - .../MaskedRecInvViolated.vdmsl.result | 151 +----------------- .../MaskedRecNamedTypeInv/Entry.java | 5 - .../MaskedRecNamedTypeInv.vdmsl.result | 2 +- .../complexstatedes/ModifyRecInMap/Entry.java | 2 - .../ModifyRecInMap.vdmsl.result | 6 - .../NamedTypeInvUnionTypeRec/Entry.java | 6 - .../NamedTypeInvUnionTypeRec.vdmsl.result | 4 +- .../RecInRecInAtomic/Entry.java | 5 - .../RecInRecInAtomic.vdmsl.result | 6 - .../RecInRecInvViolation/Entry.java | 12 -- .../RecInRecInvViolation.vdmsl.result | 37 +---- 12 files changed, 7 insertions(+), 235 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java index 7a5a3746b8..23c8dd3501 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java @@ -91,12 +91,10 @@ public static Number useOk() { //@ assert stateDes_1.valid(); - //@ assert stateDes_1.valid(); //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert r1.valid(); //@ assert Utils.is_(r1,project.Entrytypes.R1.class); //@ assert stateDes_6.valid(); @@ -106,7 +104,6 @@ public static Number useOk() { //@ assert stateDes_4.valid(); - //@ assert stateDes_4.valid(); //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); //@ assert stateDes_9.valid(); @@ -116,7 +113,6 @@ public static Number useOk() { //@ assert stateDes_7.valid(); - //@ assert stateDes_7.valid(); //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; @@ -153,12 +149,10 @@ public static Number useNotOk() { //@ assert stateDes_10.valid(); - //@ assert stateDes_10.valid(); //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert r1.valid(); //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result index bb6b9591c1..a2fc099318 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result @@ -13,10 +13,10 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:22: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:184: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:178: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) return !(Utils.equals(t3.get_r4().get_x(), 10L)); ^ -Entry.java:184: +Entry.java:178: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() @@ -76,153 +76,6 @@ Entry.java:184: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: JML invariant is false - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) - public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java index c990e401da..12305e7b9f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java @@ -79,12 +79,10 @@ public static Number useOk() { //@ assert stateDes_1.valid(); - //@ assert stateDes_1.valid(); //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert r1.valid(); //@ assert Utils.is_(r1,project.Entrytypes.R1.class); //@ assert stateDes_6.valid(); @@ -94,7 +92,6 @@ public static Number useOk() { //@ assert stateDes_4.valid(); - //@ assert stateDes_4.valid(); //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; @@ -131,12 +128,10 @@ public static Number useNotOk() { //@ assert stateDes_7.valid(); - //@ assert stateDes_7.valid(); //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert r1.valid(); //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result index e7be4c86f6..ed6064e9c9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -Entry.java:130: JML assertion is false +Entry.java:127: JML assertion is false //@ assert inv_Entry_T3(stateDes_8); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java index eab9683351..59cc1a9d6c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java @@ -54,7 +54,6 @@ public static Number useOk() { //@ assert a.valid(); - //@ assert a.valid(); //@ assert Utils.is_(a,project.Entrytypes.A.class); Number ret_1 = 0L; @@ -77,7 +76,6 @@ public static Number useNotOk() { //@ assert a.valid(); - //@ assert a.valid(); //@ assert Utils.is_(a,project.Entrytypes.A.class); Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result index 4db9c9c17d..85b789ce6c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result @@ -1,12 +1,6 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:54: JML invariant is false on leaving method project.Entrytypes.A.valid() - public Boolean valid() { - ^ -A.java:13: Associated declaration - //@ public instance invariant project.Entry.invChecksOn ==> inv_A(m); - ^ A.java:54: JML invariant is false on leaving method project.Entrytypes.A.valid() public Boolean valid() { ^ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index 8c27078d22..b80d8a817e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -119,12 +119,10 @@ public static Number useOk() { //@ assert stateDes_1.valid(); - //@ assert stateDes_1.valid(); //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert r1.valid(); //@ assert Utils.is_(r1,project.Entrytypes.R1.class); //@ assert stateDes_6.valid(); @@ -135,7 +133,6 @@ public static Number useOk() { //@ assert stateDes_4.valid(); - //@ assert stateDes_4.valid(); //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); //@ assert stateDes_9.valid(); @@ -146,7 +143,6 @@ public static Number useOk() { //@ assert stateDes_7.valid(); - //@ assert stateDes_7.valid(); //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; @@ -193,12 +189,10 @@ public static Number useNotOk() { //@ assert stateDes_10.valid(); - //@ assert stateDes_10.valid(); //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert r1.valid(); //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result index a2c0397cbc..d823c78e6a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result @@ -13,10 +13,10 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:235: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:229: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) apply_9 = ((project.Entrytypes.R3) t3).get_r4(); ^ -Entry.java:235: +Entry.java:229: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java index 862d32b2fe..7f695d585a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java @@ -72,19 +72,16 @@ public static Number useOk() { //@ assert stateDes_1.valid(); - //@ assert stateDes_1.valid(); //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert r1.valid(); //@ assert Utils.is_(r1,project.Entrytypes.R1.class); //@ assert stateDes_4.valid(); //@ assert stateDes_3.valid(); - //@ assert stateDes_3.valid(); //@ assert Utils.is_(stateDes_3,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; @@ -116,12 +113,10 @@ public static Number useNotOk() { //@ assert stateDes_5.valid(); - //@ assert stateDes_5.valid(); //@ assert Utils.is_(stateDes_5,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert r1.valid(); //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result index c2f1d2fd4e..39690ca462 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result @@ -1,12 +1,6 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: JML invariant is false on leaving method project.Entrytypes.R1.valid() - public Boolean valid() { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); - ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: JML invariant is false on leaving method project.Entrytypes.R1.valid() public Boolean valid() { ^ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java index 0be19ac7b1..bf6e145c40 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java @@ -28,17 +28,14 @@ public static Number useOk() { //@ assert stateDes_2.valid(); - //@ assert stateDes_2.valid(); //@ assert Utils.is_(stateDes_2,project.Entrytypes.T3.class); //@ assert stateDes_1.valid(); - //@ assert stateDes_1.valid(); //@ assert Utils.is_(stateDes_1,project.Entrytypes.T2.class); //@ assert t1.valid(); - //@ assert t1.valid(); //@ assert Utils.is_(t1,project.Entrytypes.T1.class); project.Entrytypes.T2 stateDes_4 = t1.get_t2(); @@ -51,17 +48,14 @@ public static Number useOk() { //@ assert stateDes_5.valid(); - //@ assert stateDes_5.valid(); //@ assert Utils.is_(stateDes_5,project.Entrytypes.T3.class); //@ assert stateDes_4.valid(); - //@ assert stateDes_4.valid(); //@ assert Utils.is_(stateDes_4,project.Entrytypes.T2.class); //@ assert t1.valid(); - //@ assert t1.valid(); //@ assert Utils.is_(t1,project.Entrytypes.T1.class); Number ret_1 = 0L; @@ -85,17 +79,14 @@ public static Number useNotOk() { //@ assert stateDes_8.valid(); - //@ assert stateDes_8.valid(); //@ assert Utils.is_(stateDes_8,project.Entrytypes.T3.class); //@ assert stateDes_7.valid(); - //@ assert stateDes_7.valid(); //@ assert Utils.is_(stateDes_7,project.Entrytypes.T2.class); //@ assert t1.valid(); - //@ assert t1.valid(); //@ assert Utils.is_(t1,project.Entrytypes.T1.class); project.Entrytypes.T2 stateDes_10 = t1.get_t2(); @@ -108,17 +99,14 @@ public static Number useNotOk() { //@ assert stateDes_11.valid(); - //@ assert stateDes_11.valid(); //@ assert Utils.is_(stateDes_11,project.Entrytypes.T3.class); //@ assert stateDes_10.valid(); - //@ assert stateDes_10.valid(); //@ assert Utils.is_(stateDes_10,project.Entrytypes.T2.class); //@ assert t1.valid(); - //@ assert t1.valid(); //@ assert Utils.is_(t1,project.Entrytypes.T1.class); Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result index c5e7263a47..8cf3dc26c9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result @@ -7,39 +7,6 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: JML invariant is false on leaving method project.Entrytypes.T2.valid() - public Boolean valid() { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: - //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) - public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) - public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) - public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) - public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: - //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: JML invariant is false - //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); - ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ @@ -124,10 +91,10 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -Entry.java:102: JML invariant is false on entering method project.Entrytypes.T2.get_t3() from project.Entry.useNotOk() +Entry.java:93: JML invariant is false on entering method project.Entrytypes.T2.get_t3() from project.Entry.useNotOk() project.Entrytypes.T3 stateDes_11 = stateDes_10.get_t3(); ^ -Entry.java:102: +Entry.java:93: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:48: JML invariant is false on leaving method project.Entrytypes.T2.get_t3() From 2ad64d1ed98514a5acb9f127d5559b0bfc842d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 12:15:46 +0200 Subject: [PATCH 094/706] Expect less dynamic type checks to occur inside atomic statement blocks --- .../complexstatedes/NamedTypeInvUnionTypeRec/Entry.java | 8 -------- .../NamedTypeInvUnionTypeRec.vdmsl.result | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index b80d8a817e..9c0a7db778 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -63,8 +63,6 @@ public static Number useOk() { if (stateDes_2 instanceof project.Entrytypes.R3) { apply_1 = ((project.Entrytypes.R3) stateDes_2).get_r4(); - - //@ assert Utils.is_(apply_1,project.Entrytypes.R4.class); } else { throw new RuntimeException("Missing member: r4"); } @@ -81,8 +79,6 @@ public static Number useOk() { if (stateDes_5 instanceof project.Entrytypes.R3) { apply_2 = ((project.Entrytypes.R3) stateDes_5).get_r4(); - - //@ assert Utils.is_(apply_2,project.Entrytypes.R4.class); } else { throw new RuntimeException("Missing member: r4"); } @@ -99,8 +95,6 @@ public static Number useOk() { if (stateDes_8 instanceof project.Entrytypes.R3) { apply_3 = ((project.Entrytypes.R3) stateDes_8).get_r4(); - - //@ assert Utils.is_(apply_3,project.Entrytypes.R4.class); } else { throw new RuntimeException("Missing member: r4"); } @@ -169,8 +163,6 @@ public static Number useNotOk() { if (stateDes_11 instanceof project.Entrytypes.R3) { apply_4 = ((project.Entrytypes.R3) stateDes_11).get_r4(); - - //@ assert Utils.is_(apply_4,project.Entrytypes.R4.class); } else { throw new RuntimeException("Missing member: r4"); } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result index d823c78e6a..bdc01d01a9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result @@ -13,10 +13,10 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:229: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:221: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) apply_9 = ((project.Entrytypes.R3) t3).get_r4(); ^ -Entry.java:229: +Entry.java:221: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() From a451c67ba17e1a18792367f729851acb7392e4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 12:18:41 +0200 Subject: [PATCH 095/706] Reduce generation of redundant JML assertions --- .../codegen/vdm2jml/InvAssertionTrans.java | 16 ++++++++++++---- .../codegen/vdm2jml/NamedTypeInvHandler.java | 7 +------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java index 8255ad1156..b037fc188a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java @@ -140,7 +140,11 @@ public void caseAAssignToExpStmCG(AAssignToExpStmCG node) * the context of an atomic statement block. Therefore, no record invariant needs to be asserted. Note that more * complicated record modifications (e.g. rec1.rec2.f := 5) appear as nodes of type caseACallObjectExpStmCG */ - namedTypeHandler.handleAssign(node); + + if(!inAtomic()) + { + namedTypeHandler.handleAssign(node); + } } @Override @@ -283,10 +287,14 @@ private void addAsserts(List objVarAsserts, { // TODO: Will the named type invariants not get handled automatically since they are local variable // decls. - buildRecChecks = true; - add(objVarAsserts, namedTypeHandler.consAssert(var)); - add(objVarAsserts, recHandler.consAssert(var)); + AMetaStmCG r = recHandler.consAssert(var); + buildRecChecks = r == null; + AMetaStmCG n = namedTypeHandler.consAssert(var); buildRecChecks = false; + + + add(objVarAsserts, n); + add(objVarAsserts, r); } private void add(List asserts, AMetaStmCG as) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java index 5256683ee3..3186eea3e5 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java @@ -385,16 +385,11 @@ public void handleAssign(AAssignToExpStmCG node) { // := atomic_tmp; - /* - * TODO: Missing handling of atomic... - * No need to assert anything since the violation would already have been detected in the temporary variable - * section - */ /* * Note that assignment to targets that are of type AFieldNumberExpCG, i.e. tuples (e.g. tup.#1 := 5) is not * allowed in VDM. */ - + SExpCG target = node.getTarget(); if (!(target instanceof SVarExpCG)) From 680598b1f59aa42d730214d3765da944ce93616d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 12:28:15 +0200 Subject: [PATCH 096/706] Expect assertion generation to change for ModuleStateInvTests' --- .../vdm2jml/tests/ModuleStateInvTests.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java index 83c532fb69..6881d21a85 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java @@ -94,7 +94,7 @@ public static void checkAssertion(String methodName, Update update, public void updateEntireState() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("assignSt", Update.ASSIGN, 0); + checkAssertion("assignSt", Update.ASSIGN, 1); } @Test @@ -103,7 +103,7 @@ public void updateEntireStateAtomic() { // No need to assert since the violation will be picked up by the // atomicTmp var assignment - checkAssertion("atomicAssignSt", Update.ASSIGN, 1); + checkAssertion("atomicAssignSt", Update.ASSIGN, 2); } @Test @@ -117,34 +117,34 @@ public void updateField() public void updateFieldAtomic() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("atomicAssignX", Update.SET_CALL, 3); + checkAssertion("atomicAssignX", Update.SET_CALL, 4); } @Test public void updateSeqElem() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("assignS", Update.MAP_SEQ_UPDATE, 2); + checkAssertion("assignS", Update.MAP_SEQ_UPDATE, 4); } @Test public void updateSeqElemAtomic() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("atomicAssignS", Update.MAP_SEQ_UPDATE, 2); + checkAssertion("atomicAssignS", Update.MAP_SEQ_UPDATE, 4); } @Test public void updateMapRng() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("assignM", Update.MAP_SEQ_UPDATE, 2); + checkAssertion("assignM", Update.MAP_SEQ_UPDATE, 4); } @Test public void updateMapRngAtomic() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("atomicAssignM", Update.MAP_SEQ_UPDATE, 2); + checkAssertion("atomicAssignM", Update.MAP_SEQ_UPDATE, 4); } } From 386cebce3bc3972516e1946942e6ce97dd236fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 13:09:34 +0200 Subject: [PATCH 097/706] Expect assertion generation to change for 'ModuleStateInvComplexTest' --- .../vdm2jml/tests/ModuleStateInvComplexTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java index 74e2126777..9f3a0246c6 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java @@ -16,27 +16,27 @@ public static void init() throws AnalysisException public void seqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("seqField", Update.SET_CALL, 2); + ModuleStateInvTests.checkAssertion("seqField", Update.SET_CALL, 4); } @Test public void mapField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("mapField", Update.SET_CALL, 2); + ModuleStateInvTests.checkAssertion("mapField", Update.SET_CALL, 4); } @Test public void fieldSeqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("fieldSeqField", Update.SET_CALL, 3); + ModuleStateInvTests.checkAssertion("fieldSeqField", Update.SET_CALL, 6); } @Test public void seqSeqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("seqSeqField", Update.SET_CALL, 2); + ModuleStateInvTests.checkAssertion("seqSeqField", Update.SET_CALL, 4); } } From 70fc5cfa648d141c24ecd3ca8d2e3c7178036e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 15:20:25 +0200 Subject: [PATCH 098/706] Updates to the code generated by the vdm2jml tests --- .../complexstatedes/MaskedRecInvViolated/Entry.java | 6 ------ .../complexstatedes/MaskedRecNamedTypeInv/Entry.java | 5 ----- .../complexstatedes/ModifyRecInMap/Entry.java | 2 -- .../NamedTypeInvUnionTypeRec/Entry.java | 6 ------ .../complexstatedes/RecInRecInAtomic/Entry.java | 5 ----- .../complexstatedes/RecInRecInvViolation/Entry.java | 12 ------------ 6 files changed, 36 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java index 23c8dd3501..c4d16f4f0b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java @@ -90,11 +90,9 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_2); //@ assert stateDes_1.valid(); - //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert Utils.is_(r1,project.Entrytypes.R1.class); //@ assert stateDes_6.valid(); @@ -103,7 +101,6 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_5); //@ assert stateDes_4.valid(); - //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); //@ assert stateDes_9.valid(); @@ -112,7 +109,6 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_8); //@ assert stateDes_7.valid(); - //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; @@ -148,11 +144,9 @@ public static Number useNotOk() { //@ assert inv_Entry_T3(stateDes_11); //@ assert stateDes_10.valid(); - //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java index 12305e7b9f..1f9ba2da52 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java @@ -78,11 +78,9 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_2); //@ assert stateDes_1.valid(); - //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert Utils.is_(r1,project.Entrytypes.R1.class); //@ assert stateDes_6.valid(); @@ -91,7 +89,6 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_5); //@ assert stateDes_4.valid(); - //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; @@ -127,11 +124,9 @@ public static Number useNotOk() { //@ assert inv_Entry_T3(stateDes_8); //@ assert stateDes_7.valid(); - //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java index 59cc1a9d6c..8f4a0ae47c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java @@ -53,7 +53,6 @@ public static Number useOk() { stateDes_2.set_x(2L); //@ assert a.valid(); - //@ assert Utils.is_(a,project.Entrytypes.A.class); Number ret_1 = 0L; @@ -75,7 +74,6 @@ public static Number useNotOk() { stateDes_4.set_x(1L); //@ assert a.valid(); - //@ assert Utils.is_(a,project.Entrytypes.A.class); Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index 9c0a7db778..0dd2509c79 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -112,11 +112,9 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_2); //@ assert stateDes_1.valid(); - //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert Utils.is_(r1,project.Entrytypes.R1.class); //@ assert stateDes_6.valid(); @@ -126,7 +124,6 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_5); //@ assert stateDes_4.valid(); - //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); //@ assert stateDes_9.valid(); @@ -136,7 +133,6 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_8); //@ assert stateDes_7.valid(); - //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; @@ -180,11 +176,9 @@ public static Number useNotOk() { //@ assert inv_Entry_T3(stateDes_11); //@ assert stateDes_10.valid(); - //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java index 7f695d585a..e6a99fdd87 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java @@ -71,17 +71,14 @@ public static Number useOk() { //@ assert stateDes_2.valid(); //@ assert stateDes_1.valid(); - //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert Utils.is_(r1,project.Entrytypes.R1.class); //@ assert stateDes_4.valid(); //@ assert stateDes_3.valid(); - //@ assert Utils.is_(stateDes_3,project.Entrytypes.R2.class); } /* End of atomic statement */ Number ret_1 = 0L; @@ -112,11 +109,9 @@ public static Number useNotOk() { //@ assert stateDes_6.valid(); //@ assert stateDes_5.valid(); - //@ assert Utils.is_(stateDes_5,project.Entrytypes.R2.class); //@ assert r1.valid(); - //@ assert Utils.is_(r1,project.Entrytypes.R1.class); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java index bf6e145c40..8159f6df8a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java @@ -27,15 +27,12 @@ public static Number useOk() { stateDes_3.set_x(6L); //@ assert stateDes_2.valid(); - //@ assert Utils.is_(stateDes_2,project.Entrytypes.T3.class); //@ assert stateDes_1.valid(); - //@ assert Utils.is_(stateDes_1,project.Entrytypes.T2.class); //@ assert t1.valid(); - //@ assert Utils.is_(t1,project.Entrytypes.T1.class); project.Entrytypes.T2 stateDes_4 = t1.get_t2(); @@ -47,15 +44,12 @@ public static Number useOk() { stateDes_6.set_x(7L); //@ assert stateDes_5.valid(); - //@ assert Utils.is_(stateDes_5,project.Entrytypes.T3.class); //@ assert stateDes_4.valid(); - //@ assert Utils.is_(stateDes_4,project.Entrytypes.T2.class); //@ assert t1.valid(); - //@ assert Utils.is_(t1,project.Entrytypes.T1.class); Number ret_1 = 0L; @@ -78,15 +72,12 @@ public static Number useNotOk() { stateDes_9.set_x(60L); //@ assert stateDes_8.valid(); - //@ assert Utils.is_(stateDes_8,project.Entrytypes.T3.class); //@ assert stateDes_7.valid(); - //@ assert Utils.is_(stateDes_7,project.Entrytypes.T2.class); //@ assert t1.valid(); - //@ assert Utils.is_(t1,project.Entrytypes.T1.class); project.Entrytypes.T2 stateDes_10 = t1.get_t2(); @@ -98,15 +89,12 @@ public static Number useNotOk() { stateDes_12.set_x(5L); //@ assert stateDes_11.valid(); - //@ assert Utils.is_(stateDes_11,project.Entrytypes.T3.class); //@ assert stateDes_10.valid(); - //@ assert Utils.is_(stateDes_10,project.Entrytypes.T2.class); //@ assert t1.valid(); - //@ assert Utils.is_(t1,project.Entrytypes.T1.class); Number ret_2 = 0L; From 601f9500e44c04d7c81ddf698f78a409a78a0a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 16:46:44 +0200 Subject: [PATCH 099/706] Construct assertions as separate meta statements --- .../org/overture/codegen/vdm2jml/IAssert.java | 9 ---- .../codegen/vdm2jml/InvAssertionTrans.java | 54 ++++++++++++------- .../codegen/vdm2jml/NamedTypeInvHandler.java | 33 +++++++----- .../codegen/vdm2jml/NamedTypeInvUtil.java | 29 ++++++---- .../codegen/vdm2jml/RecModHandler.java | 3 +- 5 files changed, 76 insertions(+), 52 deletions(-) delete mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IAssert.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IAssert.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IAssert.java deleted file mode 100644 index 7a2abc9b9d..0000000000 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IAssert.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.overture.codegen.vdm2jml; - -import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; -import org.overture.codegen.cgast.statements.AMetaStmCG; - -public interface IAssert -{ - public AMetaStmCG consAssert(AIdentifierVarExpCG var); -} diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java index b037fc188a..2522f7e458 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java @@ -100,9 +100,9 @@ public void caseAVarDeclCG(AVarDeclCG node) throws AnalysisException * (e.g. stateDes_3.set_x("a")) (i.e. assignments in the VDM-SL model) are split into variables named stateDes_ * we can also expect local variable declarations in atomic statement blocks */ - AMetaStmCG as = namedTypeHandler.handleVarDecl(node); + List as = namedTypeHandler.handleVarDecl(node); - if(as == null) + if(as == null || as.isEmpty()) { return; } @@ -121,11 +121,17 @@ public void caseAVarDeclCG(AVarDeclCG node) throws AnalysisException */ if(inAtomic()) { - addPostAtomicCheck(as); + for(AMetaStmCG a : as) + { + addPostAtomicCheck(a); + } } else { - encBlock.getStatements().addFirst(as); + for(int i = as.size() - 1; i >= 0; i--) + { + encBlock.getStatements().addFirst(as.get(i)); + } } } @@ -184,7 +190,7 @@ public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisExc private void handleStateUpdate(SStmCG node, SVarExpCG target, List objVars, AMetaStmCG recAssert, - AMetaStmCG namedTypeInvAssert) + List namedTypeInvAssert) { if (recAssert == null && namedTypeInvAssert == null && objVars == null) { @@ -209,7 +215,7 @@ private void handleStateUpdate(SStmCG node, SVarExpCG target, } private void addSubjectAssertAtomic(AMetaStmCG recAssert, - AMetaStmCG namedTypeInvAssert) + List namedTypeInvAssert) { for (AMetaStmCG a : consSubjectAsserts(recAssert, namedTypeInvAssert)) { @@ -218,7 +224,7 @@ private void addSubjectAssertAtomic(AMetaStmCG recAssert, } private void addSubjectAsserts(AMetaStmCG recAssert, - AMetaStmCG namedTypeInvAssert, ABlockStmCG replBlock) + List namedTypeInvAssert, ABlockStmCG replBlock) { for (AMetaStmCG a : consSubjectAsserts(recAssert, namedTypeInvAssert)) { @@ -227,14 +233,21 @@ private void addSubjectAsserts(AMetaStmCG recAssert, } private List consSubjectAsserts(AMetaStmCG recAssert, - AMetaStmCG namedTypeInvAssert) + List namedTypeInvAsserts) { - List asserts = new LinkedList(); + List allAsserts = new LinkedList(); - add(asserts, recAssert); - add(asserts, namedTypeInvAssert); + add(allAsserts, recAssert); + + if(namedTypeInvAsserts != null) + { + for(AMetaStmCG a : namedTypeInvAsserts) + { + add(allAsserts, a); + } + } - return asserts; + return allAsserts; } private void addStateDesAssertsAtomic(SVarExpCG target, List objVars) @@ -285,16 +298,17 @@ private List consObjVarAsserts( private void addAsserts(List objVarAsserts, AIdentifierVarExpCG var) { - // TODO: Will the named type invariants not get handled automatically since they are local variable - // decls. - AMetaStmCG r = recHandler.consAssert(var); - buildRecChecks = r == null; - AMetaStmCG n = namedTypeHandler.consAssert(var); + buildRecChecks = true; + List asserts = namedTypeHandler.consAsserts(var); buildRecChecks = false; - - add(objVarAsserts, n); - add(objVarAsserts, r); + if(asserts != null) + { + for(AMetaStmCG a : asserts) + { + add(objVarAsserts, a); + } + } } private void add(List asserts, AMetaStmCG as) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java index 3186eea3e5..8771a069b3 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java @@ -27,7 +27,7 @@ import org.overture.codegen.logging.Logger; import org.overture.codegen.trans.assistants.TransAssistantCG; -public class NamedTypeInvHandler implements IAssert +public class NamedTypeInvHandler { public static final String RET_VAR_NAME_PREFIX = "ret_"; public static final String MAP_SEQ_NAME_PREFIX = "col_"; @@ -87,8 +87,11 @@ public void handleField(AFieldDeclCG node) { AIdentifierVarExpCG var = getJmlGen().getJavaGen().getInfo().getExpAssistant().consIdVar(node.getName(), node.getType().clone()); - String inv = util.consJmlCheck(encClass.getName(), JmlGenerator.JML_PUBLIC, JmlGenerator.JML_STATIC_INV_ANNOTATION, false, invTypes, var); - getAnnotator().appendMetaData(node, getAnnotator().consMetaData(inv)); + List invStrings = util.consJmlCheck(encClass.getName(), JmlGenerator.JML_PUBLIC, JmlGenerator.JML_STATIC_INV_ANNOTATION, false, invTypes, var); + for(String invStr : invStrings) + { + getAnnotator().appendMetaData(node, getAnnotator().consMetaData(invStr)); + } } else { @@ -224,8 +227,11 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException * Upon entering a record setter it is necessary to check if invariants checks are enabled before * checking the parameter */ - AMetaStmCG as = util.consAssertStm(invTypes, encClassName, var, node, invTrans.getRecInfo()); - replBody.getStatements().add(as); + List as = util.consAssertStm(invTypes, encClassName, var, node, invTrans.getRecInfo()); + for(AMetaStmCG a : as) + { + replBody.getStatements().add(a); + } } } @@ -235,7 +241,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException body.apply(invTrans); } - public AMetaStmCG handleMapSeq(AMapSeqUpdateStmCG node) + public List handleMapSeq(AMapSeqUpdateStmCG node) { // TODO: Consider this for the atomic statement @@ -288,7 +294,7 @@ public AMetaStmCG handleMapSeq(AMapSeqUpdateStmCG node) return null; } - public AMetaStmCG handleVarDecl(AVarDeclCG node) + public List handleVarDecl(AVarDeclCG node) { // Examples: // let x : Even = 1 in ... @@ -324,7 +330,7 @@ public AMetaStmCG handleVarDecl(AVarDeclCG node) return null; } - public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) + public List handleCallObj(ACallObjectExpStmCG node) { /** * Handling of setter calls to masked records. This will happen for cases like T = R ... ; R :: x : int; @@ -416,8 +422,12 @@ public void handleAssign(AAssignToExpStmCG node) * Since assignments can occur inside record setters in the context of an atomic statement block we need to * check if invariant checks are enabled */ - AMetaStmCG assertStm = util.consAssertStm(invTypes, encClass.getName(), var, node, invTrans.getRecInfo()); - addAssert(node, assertStm); + List asserts = util.consAssertStm(invTypes, encClass.getName(), var, node, invTrans.getRecInfo()); + + for(AMetaStmCG a : asserts) + { + addAssert(node, a); + } } } @@ -472,8 +482,7 @@ public JmlGenerator getJmlGen() return invTrans.getJmlGen(); } - @Override - public AMetaStmCG consAssert(AIdentifierVarExpCG var) + public List consAsserts(AIdentifierVarExpCG var) { List invTypes = util.findTypeInfo(var.getType()); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java index a218ff7144..997486ad69 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java @@ -27,15 +27,19 @@ public NamedTypeInvUtil(NamedTypeInvHandler handler) this.handler = handler; } - public String consJmlCheck(String enclosingClass, String jmlVisibility, + public List consJmlCheck(String enclosingClass, String jmlVisibility, String annotationType, boolean invChecksGuard, List typeInfoMatches, SVarExpCG var) { + List predStrs = new LinkedList<>(); + StringBuilder inv = new StringBuilder(); if(handler.getInvAssertTrans().buildRecValidChecks()) { appendRecValidChecks(invChecksGuard, typeInfoMatches, var, inv); + predStrs.add(inv.toString()); + inv = new StringBuilder(); } inv.append("//@ "); @@ -83,7 +87,9 @@ public String consJmlCheck(String enclosingClass, String jmlVisibility, inv.append(';'); // Inject the name of the field into the expression - return String.format(inv.toString(), var.getName()); + predStrs.add(String.format(inv.toString(), var.getName())); + + return predStrs; } private String consInvChecksGuard() @@ -169,18 +175,23 @@ private List getRecTypes( return recTypes; } - public AMetaStmCG consAssertStm(List invTypes, + public List consAssertStm(List invTypes, String encClassName, SVarExpCG var, INode node, RecClassInfo recInfo) { boolean inAccessor = node != null && recInfo != null && recInfo.inAccessor(node); + + List asserts = new LinkedList<>(); + List assertStrs = consJmlCheck(encClassName, null, JmlGenerator.JML_ASSERT_ANNOTATION, inAccessor, invTypes, var); - - AMetaStmCG assertStm = new AMetaStmCG(); - String assertStr = consJmlCheck(encClassName, null, JmlGenerator.JML_ASSERT_ANNOTATION, inAccessor, invTypes, var); - List assertMetaData = handler.getJmlGen().getAnnotator().consMetaData(assertStr); - handler.getJmlGen().getAnnotator().appendMetaData(assertStm, assertMetaData); + for(String a : assertStrs) + { + AMetaStmCG assertStm = new AMetaStmCG(); + List assertMetaData = handler.getJmlGen().getAnnotator().consMetaData(a); + handler.getJmlGen().getAnnotator().appendMetaData(assertStm, assertMetaData); + asserts.add(assertStm); + } - return assertStm; + return asserts; } public AMetaStmCG consVarNotNullAssert(String varName) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModHandler.java index 1a1fadc468..1176bf643a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModHandler.java @@ -6,7 +6,7 @@ import org.overture.codegen.cgast.statements.AMetaStmCG; import org.overture.codegen.logging.Logger; -public class RecModHandler implements IAssert +public class RecModHandler { private InvAssertionTrans invTrans; private RecModUtil util; @@ -46,7 +46,6 @@ public InvAssertionTrans getInvTrans() return invTrans; } - @Override public AMetaStmCG consAssert(AIdentifierVarExpCG var) { if (util.assertRec(var)) From 87c2ab32ee0ff3bfcdd4f2c7e9738d74901ce93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 16:54:11 +0200 Subject: [PATCH 100/706] Updates to test results --- .../MaskedRecInvViolated/Entry.java | 30 ++++++++++------ .../MaskedRecInvViolated.vdmsl.result | 16 ++++----- .../MaskedRecNamedTypeInv/Entry.java | 24 ++++++++----- .../MaskedRecNamedTypeInv.vdmsl.result | 2 +- .../complexstatedes/ModifyRecInMap/Entry.java | 6 ++-- .../NamedTypeInvUnionTypeRec/Entry.java | 30 ++++++++++------ .../NamedTypeInvUnionTypeRec.vdmsl.result | 16 ++++----- .../RecInRecInAtomic/Entry.java | 15 +++++--- .../RecInRecInvViolation/Entry.java | 36 ++++++++++++------- 9 files changed, 111 insertions(+), 64 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java index c4d16f4f0b..8c017834aa 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java @@ -86,30 +86,37 @@ public static Number useOk() { //@ assert stateDes_3.valid(); - //@ assert stateDes_2.valid(); //@ assert inv_Entry_T3(stateDes_2); - //@ assert stateDes_1.valid(); + //@ assert stateDes_2.valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); - //@ assert r1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + //@ assert r1.valid(); + //@ assert stateDes_6.valid(); - //@ assert stateDes_5.valid(); //@ assert inv_Entry_T3(stateDes_5); - //@ assert stateDes_4.valid(); + //@ assert stateDes_5.valid(); + //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); + //@ assert stateDes_4.valid(); + //@ assert stateDes_9.valid(); - //@ assert stateDes_8.valid(); //@ assert inv_Entry_T3(stateDes_8); - //@ assert stateDes_7.valid(); + //@ assert stateDes_8.valid(); + //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); + + //@ assert stateDes_7.valid(); } /* End of atomic statement */ Number ret_1 = 0L; @@ -140,14 +147,17 @@ public static Number useNotOk() { //@ assert stateDes_12.valid(); - //@ assert stateDes_11.valid(); //@ assert inv_Entry_T3(stateDes_11); - //@ assert stateDes_10.valid(); + //@ assert stateDes_11.valid(); + //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); - //@ assert r1.valid(); + //@ assert stateDes_10.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + + //@ assert r1.valid(); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result index a2fc099318..bdeaf9a4f7 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result @@ -1,22 +1,16 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:63: JML invariant is false on leaving method project.Entrytypes.R3.valid() - public Boolean valid() { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:63: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:22: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) public boolean equals(final Object obj) { ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:22: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:178: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:182: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) return !(Utils.equals(t3.get_r4().get_x(), 10L)); ^ -Entry.java:178: +Entry.java:182: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() @@ -25,6 +19,12 @@ Entry.java:178: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:48: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:63: JML invariant is false on leaving method project.Entrytypes.R3.valid() + public Boolean valid() { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:63: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java index 1f9ba2da52..f27e5b7557 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java @@ -74,22 +74,27 @@ public static Number useOk() { //@ assert stateDes_3.valid(); - //@ assert stateDes_2.valid(); //@ assert inv_Entry_T3(stateDes_2); - //@ assert stateDes_1.valid(); + //@ assert stateDes_2.valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); - //@ assert r1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + //@ assert r1.valid(); + //@ assert stateDes_6.valid(); - //@ assert stateDes_5.valid(); //@ assert inv_Entry_T3(stateDes_5); - //@ assert stateDes_4.valid(); + //@ assert stateDes_5.valid(); + //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); + + //@ assert stateDes_4.valid(); } /* End of atomic statement */ Number ret_1 = 0L; @@ -120,14 +125,17 @@ public static Number useNotOk() { //@ assert stateDes_9.valid(); - //@ assert stateDes_8.valid(); //@ assert inv_Entry_T3(stateDes_8); - //@ assert stateDes_7.valid(); + //@ assert stateDes_8.valid(); + //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); - //@ assert r1.valid(); + //@ assert stateDes_7.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + + //@ assert r1.valid(); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result index ed6064e9c9..6a5d36199c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -Entry.java:127: JML assertion is false +Entry.java:128: JML assertion is false //@ assert inv_Entry_T3(stateDes_8); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java index 8f4a0ae47c..81ccd7aa71 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java @@ -52,8 +52,9 @@ public static Number useOk() { //@ assert stateDes_2 != null; stateDes_2.set_x(2L); - //@ assert a.valid(); //@ assert Utils.is_(a,project.Entrytypes.A.class); + + //@ assert a.valid(); Number ret_1 = 0L; //@ assert Utils.is_nat(ret_1); @@ -73,8 +74,9 @@ public static Number useNotOk() { //@ assert stateDes_4 != null; stateDes_4.set_x(1L); - //@ assert a.valid(); //@ assert Utils.is_(a,project.Entrytypes.A.class); + + //@ assert a.valid(); Number ret_2 = 0L; //@ assert Utils.is_nat(ret_2); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index 0dd2509c79..d8ec1fa825 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -107,33 +107,40 @@ public static Number useOk() { //@ assert stateDes_3.valid(); + //@ assert inv_Entry_T3(stateDes_2); + //@ assert stateDes_2 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_2).valid(); //@ assert stateDes_2 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_2).valid(); - //@ assert inv_Entry_T3(stateDes_2); - //@ assert stateDes_1.valid(); //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); - //@ assert r1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + //@ assert r1.valid(); + //@ assert stateDes_6.valid(); + //@ assert inv_Entry_T3(stateDes_5); + //@ assert stateDes_5 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_5).valid(); //@ assert stateDes_5 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_5).valid(); - //@ assert inv_Entry_T3(stateDes_5); - //@ assert stateDes_4.valid(); //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); + //@ assert stateDes_4.valid(); + //@ assert stateDes_9.valid(); + //@ assert inv_Entry_T3(stateDes_8); + //@ assert stateDes_8 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_8).valid(); //@ assert stateDes_8 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_8).valid(); - //@ assert inv_Entry_T3(stateDes_8); - //@ assert stateDes_7.valid(); //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); + + //@ assert stateDes_7.valid(); } /* End of atomic statement */ Number ret_1 = 0L; @@ -171,15 +178,18 @@ public static Number useNotOk() { //@ assert stateDes_12.valid(); + //@ assert inv_Entry_T3(stateDes_11); + //@ assert stateDes_11 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_11).valid(); //@ assert stateDes_11 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_11).valid(); - //@ assert inv_Entry_T3(stateDes_11); - //@ assert stateDes_10.valid(); //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); - //@ assert r1.valid(); + //@ assert stateDes_10.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + + //@ assert r1.valid(); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result index bdc01d01a9..f29d0e9b4f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result @@ -1,22 +1,16 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:63: JML invariant is false on leaving method project.Entrytypes.R3.valid() - public Boolean valid() { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:63: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) public boolean equals(final Object obj) { ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:221: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:225: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) apply_9 = ((project.Entrytypes.R3) t3).get_r4(); ^ -Entry.java:221: +Entry.java:225: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() @@ -25,4 +19,10 @@ Entry.java:221: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:63: JML invariant is false on leaving method project.Entrytypes.R3.valid() + public Boolean valid() { + ^ +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:63: + //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); + ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java index e6a99fdd87..0439f4d7fc 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java @@ -70,16 +70,19 @@ public static Number useOk() { //@ assert stateDes_2.valid(); - //@ assert stateDes_1.valid(); //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); - //@ assert r1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + //@ assert r1.valid(); + //@ assert stateDes_4.valid(); - //@ assert stateDes_3.valid(); //@ assert Utils.is_(stateDes_3,project.Entrytypes.R2.class); + + //@ assert stateDes_3.valid(); } /* End of atomic statement */ Number ret_1 = 0L; @@ -108,11 +111,13 @@ public static Number useNotOk() { //@ assert stateDes_6.valid(); - //@ assert stateDes_5.valid(); //@ assert Utils.is_(stateDes_5,project.Entrytypes.R2.class); - //@ assert r1.valid(); + //@ assert stateDes_5.valid(); + //@ assert Utils.is_(r1,project.Entrytypes.R1.class); + + //@ assert r1.valid(); } /* End of atomic statement */ Number ret_2 = 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java index 8159f6df8a..9cec65e792 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java @@ -26,14 +26,17 @@ public static Number useOk() { //@ assert stateDes_3 != null; stateDes_3.set_x(6L); - //@ assert stateDes_2.valid(); //@ assert Utils.is_(stateDes_2,project.Entrytypes.T3.class); - //@ assert stateDes_1.valid(); + //@ assert stateDes_2.valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.T2.class); - //@ assert t1.valid(); + //@ assert stateDes_1.valid(); + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); + + //@ assert t1.valid(); project.Entrytypes.T2 stateDes_4 = t1.get_t2(); project.Entrytypes.T3 stateDes_5 = stateDes_4.get_t3(); @@ -43,14 +46,17 @@ public static Number useOk() { //@ assert stateDes_6 != null; stateDes_6.set_x(7L); - //@ assert stateDes_5.valid(); //@ assert Utils.is_(stateDes_5,project.Entrytypes.T3.class); - //@ assert stateDes_4.valid(); + //@ assert stateDes_5.valid(); + //@ assert Utils.is_(stateDes_4,project.Entrytypes.T2.class); - //@ assert t1.valid(); + //@ assert stateDes_4.valid(); + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); + + //@ assert t1.valid(); Number ret_1 = 0L; //@ assert Utils.is_nat(ret_1); @@ -71,14 +77,17 @@ public static Number useNotOk() { //@ assert stateDes_9 != null; stateDes_9.set_x(60L); - //@ assert stateDes_8.valid(); //@ assert Utils.is_(stateDes_8,project.Entrytypes.T3.class); - //@ assert stateDes_7.valid(); + //@ assert stateDes_8.valid(); + //@ assert Utils.is_(stateDes_7,project.Entrytypes.T2.class); - //@ assert t1.valid(); + //@ assert stateDes_7.valid(); + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); + + //@ assert t1.valid(); project.Entrytypes.T2 stateDes_10 = t1.get_t2(); project.Entrytypes.T3 stateDes_11 = stateDes_10.get_t3(); @@ -88,14 +97,17 @@ public static Number useNotOk() { //@ assert stateDes_12 != null; stateDes_12.set_x(5L); - //@ assert stateDes_11.valid(); //@ assert Utils.is_(stateDes_11,project.Entrytypes.T3.class); - //@ assert stateDes_10.valid(); + //@ assert stateDes_11.valid(); + //@ assert Utils.is_(stateDes_10,project.Entrytypes.T2.class); - //@ assert t1.valid(); + //@ assert stateDes_10.valid(); + //@ assert Utils.is_(t1,project.Entrytypes.T1.class); + + //@ assert t1.valid(); Number ret_2 = 0L; //@ assert Utils.is_nat(ret_2); From 86943650def088ad72dd88fe654b7eb6b12a96e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 19:39:29 +0200 Subject: [PATCH 101/706] Construct record validity checks as separate assertions --- .../overture/codegen/vdm2jml/NamedTypeInvUtil.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java index 997486ad69..d36754218a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java @@ -33,15 +33,12 @@ public List consJmlCheck(String enclosingClass, String jmlVisibility, { List predStrs = new LinkedList<>(); - StringBuilder inv = new StringBuilder(); - if(handler.getInvAssertTrans().buildRecValidChecks()) { - appendRecValidChecks(invChecksGuard, typeInfoMatches, var, inv); - predStrs.add(inv.toString()); - inv = new StringBuilder(); + appendRecValidChecks(invChecksGuard, typeInfoMatches, var, predStrs); } + StringBuilder inv = new StringBuilder(); inv.append("//@ "); if (jmlVisibility != null) @@ -103,7 +100,7 @@ private String consInvChecksGuard() private void appendRecValidChecks(boolean invChecksGuard, List typeInfoMatches, SVarExpCG var, - StringBuilder inv) + List predStrs) { List recordTypes = getRecTypes(typeInfoMatches); @@ -111,6 +108,7 @@ private void appendRecValidChecks(boolean invChecksGuard, { for (ARecordTypeCG rt : recordTypes) { + StringBuilder inv = new StringBuilder(); String fullyQualifiedRecType = fullyQualifiedRecType(rt); inv.append("//@ "); @@ -140,7 +138,7 @@ private void appendRecValidChecks(boolean invChecksGuard, } inv.append(';'); - inv.append('\n'); + predStrs.add(inv.toString()); } } } From 97c5bd5efa9f58268a0e589e64464c9f4e2a762b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 19:41:21 +0200 Subject: [PATCH 102/706] Updates to test artefacts: reorderings of assertions in one of the recorded execution traces --- .../NamedTypeInvUnionTypeRec/Entry.java | 12 ++++++++---- .../NamedTypeInvUnionTypeRec.vdmsl.result | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index d8ec1fa825..39dc48fb39 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -109,9 +109,10 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_2); - //@ assert stateDes_2 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_2).valid(); //@ assert stateDes_2 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_2).valid(); + //@ assert stateDes_2 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_2).valid(); + //@ assert Utils.is_(stateDes_1,project.Entrytypes.R2.class); //@ assert stateDes_1.valid(); @@ -124,9 +125,10 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_5); - //@ assert stateDes_5 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_5).valid(); //@ assert stateDes_5 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_5).valid(); + //@ assert stateDes_5 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_5).valid(); + //@ assert Utils.is_(stateDes_4,project.Entrytypes.R2.class); //@ assert stateDes_4.valid(); @@ -135,9 +137,10 @@ public static Number useOk() { //@ assert inv_Entry_T3(stateDes_8); - //@ assert stateDes_8 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_8).valid(); //@ assert stateDes_8 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_8).valid(); + //@ assert stateDes_8 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_8).valid(); + //@ assert Utils.is_(stateDes_7,project.Entrytypes.R2.class); //@ assert stateDes_7.valid(); @@ -180,9 +183,10 @@ public static Number useNotOk() { //@ assert inv_Entry_T3(stateDes_11); - //@ assert stateDes_11 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_11).valid(); //@ assert stateDes_11 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_11).valid(); + //@ assert stateDes_11 instanceof project.Entrytypes.R3 ==> ((project.Entrytypes.R3) stateDes_11).valid(); + //@ assert Utils.is_(stateDes_10,project.Entrytypes.R2.class); //@ assert stateDes_10.valid(); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result index f29d0e9b4f..5e10a218ce 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result @@ -7,10 +7,10 @@ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -Entry.java:225: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:229: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) apply_9 = ((project.Entrytypes.R3) t3).get_r4(); ^ -Entry.java:225: +Entry.java:229: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() From 5aa0a8580455a7e862d36ad76399a2e54987170b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 9 Oct 2015 20:10:30 +0200 Subject: [PATCH 103/706] Package and name refactoring for vdm2jml --- .../overture/codegen/vdm2jml/JmlGenUtil.java | 5 ++ .../codegen/vdm2jml/JmlGenerator.java | 11 ++- .../vdm2jml/{ => data}/RecClassInfo.java | 2 +- .../vdm2jml/{ => data}/StateDesInfo.java | 2 +- .../{ => predgen}/AtomicAssertTrans.java | 5 +- .../vdm2jml/{ => predgen}/RecModHandler.java | 8 +- .../vdm2jml/{ => predgen}/RecModUtil.java | 3 +- .../TypePredDecorator.java} | 19 +++-- .../TypePredHandler.java} | 80 ++++++++++--------- .../TypePredUtil.java} | 23 +++--- .../{ => predgen/info}/AbstractTypeInfo.java | 2 +- .../{ => predgen/info}/LeafTypeInfo.java | 3 +- .../{ => predgen/info}/NamedTypeInfo.java | 4 +- .../info}/NamedTypeInvDepCalculator.java | 2 +- .../vdm2jml/{ => trans}/RecAccessorTrans.java | 4 +- .../{ => trans}/RecInvTransformation.java | 2 +- .../{ => trans}/TargetNormaliserTrans.java | 4 +- .../vdm2jml/{ => util}/IsValChecker.java | 2 +- .../codegen/vdm2jml/{ => util}/NameGen.java | 2 +- .../vdm2jml/tests/JmlOutputTests.java | 2 + .../vdm2jml/tests/JmlPassTypeCheckTests.java | 3 +- .../vdm2jml/tests/LeafTypeCallTests.java | 2 +- .../tests/ModuleStateInvComplexTests.java | 1 + .../vdm2jml/tests/ModuleStateInvTests.java | 1 + .../overture/vdm2jml/tests/NameGenTests.java | 2 +- .../vdm2jml/tests/OpenJmlValidationBase.java | 3 +- .../vdm2jml/tests/TypeDependencyTests.java | 6 +- .../tests/{ => exec}/JmlAtomicExecTests.java | 3 +- .../JmlComplexStateDesExecTests.java | 3 +- .../tests/{ => exec}/JmlExecTestBase.java | 7 +- .../{ => exec}/JmlNamedTypeInvExecTests.java | 3 +- .../tests/{ => exec}/JmlPrePostExecTests.java | 3 +- .../tests/{ => exec}/JmlRecInvExecTests.java | 3 +- .../{ => exec}/OptionalTypeExecTests.java | 3 +- .../vdm2jml/tests/util}/IOpenJmlConsts.java | 2 +- .../vdm2jml/tests/{ => util}/TestUtil.java | 4 +- .../vdm2jml/tests/{ => util}/Update.java | 2 +- 37 files changed, 143 insertions(+), 93 deletions(-) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => data}/RecClassInfo.java (97%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => data}/StateDesInfo.java (97%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => predgen}/AtomicAssertTrans.java (93%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => predgen}/RecModHandler.java (87%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => predgen}/RecModUtil.java (93%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{InvAssertionTrans.java => predgen/TypePredDecorator.java} (92%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{NamedTypeInvHandler.java => predgen/TypePredHandler.java} (86%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{NamedTypeInvUtil.java => predgen/TypePredUtil.java} (92%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => predgen/info}/AbstractTypeInfo.java (91%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => predgen/info}/LeafTypeInfo.java (97%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => predgen/info}/NamedTypeInfo.java (98%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => predgen/info}/NamedTypeInvDepCalculator.java (98%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => trans}/RecAccessorTrans.java (98%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => trans}/RecInvTransformation.java (99%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => trans}/TargetNormaliserTrans.java (97%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => util}/IsValChecker.java (97%) rename core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/{ => util}/NameGen.java (96%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => exec}/JmlAtomicExecTests.java (89%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => exec}/JmlComplexStateDesExecTests.java (90%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => exec}/JmlExecTestBase.java (96%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => exec}/JmlNamedTypeInvExecTests.java (89%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => exec}/JmlPrePostExecTests.java (89%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => exec}/JmlRecInvExecTests.java (89%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => exec}/OptionalTypeExecTests.java (89%) rename core/codegen/vdm2jml/src/{main/java/org/overture/codegen/vdm2jml => test/java/org/overture/vdm2jml/tests/util}/IOpenJmlConsts.java (88%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => util}/TestUtil.java (93%) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/{ => util}/Update.java (58%) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java index 64ac7efdb1..8d72a7448d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java @@ -35,6 +35,11 @@ import org.overture.codegen.logging.Logger; import org.overture.codegen.vdm2java.JavaCodeGenUtil; import org.overture.codegen.vdm2java.JavaFormat; +import org.overture.codegen.vdm2jml.data.RecClassInfo; +import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; +import org.overture.codegen.vdm2jml.util.NameGen; public class JmlGenUtil { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java index 7a9005ee88..7d9f032b84 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java @@ -40,7 +40,16 @@ import org.overture.codegen.vdm2java.JavaCodeGen; import org.overture.codegen.vdm2java.JavaCodeGenUtil; import org.overture.codegen.vdm2java.JavaSettings; +import org.overture.codegen.vdm2jml.data.RecClassInfo; +import org.overture.codegen.vdm2jml.data.StateDesInfo; +import org.overture.codegen.vdm2jml.predgen.TypePredDecorator; +import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; +import org.overture.codegen.vdm2jml.trans.RecAccessorTrans; +import org.overture.codegen.vdm2jml.trans.RecInvTransformation; +import org.overture.codegen.vdm2jml.trans.TargetNormaliserTrans; import org.overture.codegen.vdm2jml.util.AnnotationSorter; +import org.overture.codegen.vdm2jml.util.IsValChecker; import de.hunsicker.jalopy.storage.Convention; import de.hunsicker.jalopy.storage.ConventionKeys; @@ -378,7 +387,7 @@ private void computeNamedTypeInvInfo(List ast) throws AnalysisEx private void addAssertions(List> newAst, StateDesInfo stateDesInfo, RecClassInfo recInfo) { - InvAssertionTrans assertTr = new InvAssertionTrans(this, stateDesInfo, recInfo); + TypePredDecorator assertTr = new TypePredDecorator(this, stateDesInfo, recInfo); for (IRStatus status : IRStatus.extract(newAst, ADefaultClassDeclCG.class)) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/data/RecClassInfo.java similarity index 97% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/data/RecClassInfo.java index 0f11116a0f..0459a2b529 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecClassInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/data/RecClassInfo.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.data; import java.util.HashSet; import java.util.LinkedList; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/StateDesInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/data/StateDesInfo.java similarity index 97% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/StateDesInfo.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/data/StateDesInfo.java index 7665171828..845c9d70e5 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/StateDesInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/data/StateDesInfo.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.data; import java.util.HashMap; import java.util.List; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AtomicAssertTrans.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/AtomicAssertTrans.java similarity index 93% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AtomicAssertTrans.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/AtomicAssertTrans.java index 58e15b6a8f..372208e1c4 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AtomicAssertTrans.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/AtomicAssertTrans.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen; import java.util.LinkedList; import java.util.List; @@ -9,6 +9,7 @@ import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; import org.overture.codegen.cgast.statements.AAtomicStmCG; import org.overture.codegen.cgast.statements.AMetaStmCG; +import org.overture.codegen.vdm2jml.JmlGenerator; public abstract class AtomicAssertTrans extends DepthFirstAnalysisAdaptor { @@ -41,7 +42,7 @@ public void caseAAtomicStmCG(AAtomicStmCG node) throws AnalysisException recVarChecks = null; } - protected AMetaStmCG consMetaStm(String str) + public AMetaStmCG consMetaStm(String str) { AMetaStmCG assertion = new AMetaStmCG(); jmlGen.getAnnotator().appendMetaData(assertion, jmlGen.getAnnotator().consMetaData(str)); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/RecModHandler.java similarity index 87% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModHandler.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/RecModHandler.java index 1176bf643a..aa7ad11f37 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/RecModHandler.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; import org.overture.codegen.cgast.expressions.SVarExpCG; @@ -8,10 +8,10 @@ public class RecModHandler { - private InvAssertionTrans invTrans; + private TypePredDecorator invTrans; private RecModUtil util; - public RecModHandler(InvAssertionTrans invTrans) + public RecModHandler(TypePredDecorator invTrans) { this.invTrans = invTrans; this.util = new RecModUtil(this); @@ -41,7 +41,7 @@ public AMetaStmCG handleCallObj(ACallObjectExpStmCG node) return null; } - public InvAssertionTrans getInvTrans() + public TypePredDecorator getInvTrans() { return invTrans; } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/RecModUtil.java similarity index 93% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModUtil.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/RecModUtil.java index dc4e8e2d47..d686d7ede5 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecModUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/RecModUtil.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen; import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; @@ -7,6 +7,7 @@ import org.overture.codegen.cgast.statements.AMetaStmCG; import org.overture.codegen.cgast.types.ARecordTypeCG; import org.overture.codegen.ir.IRInfo; +import org.overture.codegen.vdm2jml.JmlGenerator; public class RecModUtil { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredDecorator.java similarity index 92% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredDecorator.java index 2522f7e458..024f568511 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/InvAssertionTrans.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredDecorator.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen; import java.util.Collections; import java.util.LinkedList; @@ -19,29 +19,34 @@ import org.overture.codegen.cgast.statements.AMetaStmCG; import org.overture.codegen.cgast.statements.AReturnStmCG; import org.overture.codegen.logging.Logger; +import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.data.RecClassInfo; +import org.overture.codegen.vdm2jml.data.StateDesInfo; +import org.overture.codegen.vdm2jml.trans.RecAccessorTrans; +import org.overture.codegen.vdm2jml.trans.TargetNormaliserTrans; /** - * This class is responsible for adding additional assertions to the IR to preserve the semantics of the contract-based - * notations of VDM-SL when they are translated to JML annotated Java. + * This class is responsible for adding additional checks, like assertions, to the IR to preserve the semantics of the + * contract-based notations of VDM-SL when they are translated to JML annotated Java. * * @see RecAccessorTrans * @see TargetNormaliserTrans */ -public class InvAssertionTrans extends AtomicAssertTrans +public class TypePredDecorator extends AtomicAssertTrans { private RecModHandler recHandler; - private NamedTypeInvHandler namedTypeHandler; + private TypePredHandler namedTypeHandler; private StateDesInfo stateDesInfo; private RecClassInfo recInfo; private boolean buildRecChecks = false; - public InvAssertionTrans(JmlGenerator jmlGen, StateDesInfo stateDesInfo, + public TypePredDecorator(JmlGenerator jmlGen, StateDesInfo stateDesInfo, RecClassInfo recInfo) { super(jmlGen); this.recHandler = new RecModHandler(this); - this.namedTypeHandler = new NamedTypeInvHandler(this); + this.namedTypeHandler = new TypePredHandler(this); this.stateDesInfo = stateDesInfo; this.recInfo = recInfo; } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java similarity index 86% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java index 8771a069b3..385eeac4f8 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen; import java.util.LinkedList; import java.util.List; @@ -26,24 +26,28 @@ import org.overture.codegen.ir.IRInfo; import org.overture.codegen.logging.Logger; import org.overture.codegen.trans.assistants.TransAssistantCG; +import org.overture.codegen.vdm2jml.JmlAnnotationHelper; +import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.predgen.info.AbstractTypeInfo; +import org.overture.codegen.vdm2jml.util.IsValChecker; -public class NamedTypeInvHandler +public class TypePredHandler { public static final String RET_VAR_NAME_PREFIX = "ret_"; public static final String MAP_SEQ_NAME_PREFIX = "col_"; - private InvAssertionTrans invTrans; - private NamedTypeInvUtil util; + private TypePredDecorator decorator; + private TypePredUtil util; - public InvAssertionTrans getInvAssertTrans() + public TypePredDecorator getDecorator() { - return invTrans; + return decorator; } - public NamedTypeInvHandler(InvAssertionTrans invTrans) + public TypePredHandler(TypePredDecorator decorator) { - this.invTrans = invTrans; - this.util = new NamedTypeInvUtil(this); + this.decorator = decorator; + this.util = new TypePredUtil(this); } public void handleClass(ADefaultClassDeclCG node) throws AnalysisException @@ -53,12 +57,12 @@ public void handleClass(ADefaultClassDeclCG node) throws AnalysisException for (AFieldDeclCG f : node.getFields()) { - f.apply(invTrans); + f.apply(decorator); } for (AMethodDeclCG m : node.getMethods()) { - m.apply(invTrans); + m.apply(decorator); } } @@ -68,14 +72,14 @@ public void handleField(AFieldDeclCG node) * Values and record fields will be handled by this handler (not the state component field since its type is a * record type) Example: val : char | Even = 5; */ - ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) { return; } - if (!invTrans.getRecInfo().isRecField(node) && node.getFinal()) + if (!decorator.getRecInfo().isRecField(node) && node.getFinal()) { /** * So at this point it must be a value defined in a module. No need to check if invariant checks are enabled. @@ -111,7 +115,7 @@ public void handleField(AFieldDeclCG node) private JmlAnnotationHelper getAnnotator() { - return invTrans.getJmlGen().getAnnotator(); + return decorator.getJmlGen().getAnnotator(); } public void handleBlock(ABlockStmCG node) throws AnalysisException @@ -132,19 +136,19 @@ public void handleBlock(ABlockStmCG node) throws AnalysisException for (SStmCG stm : node.getStatements()) { - stm.apply(invTrans); + stm.apply(decorator); } } else { if(!node.getLocalDefs().isEmpty()) { - node.getLocalDefs().getFirst().apply(invTrans); + node.getLocalDefs().getFirst().apply(decorator); } for (SStmCG stm : node.getStatements()) { - stm.apply(invTrans); + stm.apply(decorator); } } } @@ -157,7 +161,7 @@ public void handleReturn(AReturnStmCG node) throws AnalysisException */ SExpCG exp = node.getExp(); - AMethodDeclCG encMethod = invTrans.getJmlGen().getUtil().getEnclosingMethod(node); + AMethodDeclCG encMethod = decorator.getJmlGen().getUtil().getEnclosingMethod(node); if (encMethod == null) { @@ -186,7 +190,7 @@ public void handleReturn(AReturnStmCG node) throws AnalysisException getTransAssist().replaceNodeWith(node, replBlock); replBlock.getStatements().add(node); - varDecl.apply(invTrans); + varDecl.apply(decorator); } public void handleMethod(AMethodDeclCG node) throws AnalysisException @@ -205,7 +209,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException if (!invTypes.isEmpty()) { - ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) { @@ -214,7 +218,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException String encClassName = encClass.getName(); - String varNameStr = invTrans.getJmlGen().getUtil().getName(param.getPattern()); + String varNameStr = decorator.getJmlGen().getUtil().getName(param.getPattern()); if (varNameStr == null) { @@ -227,7 +231,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException * Upon entering a record setter it is necessary to check if invariants checks are enabled before * checking the parameter */ - List as = util.consAssertStm(invTypes, encClassName, var, node, invTrans.getRecInfo()); + List as = util.consAssertStm(invTypes, encClassName, var, node, decorator.getRecInfo()); for(AMetaStmCG a : as) { replBody.getStatements().add(a); @@ -238,7 +242,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException SStmCG body = node.getBody(); getTransAssist().replaceNodeWith(body, replBody); replBody.getStatements().add(body); - body.apply(invTrans); + body.apply(decorator); } public List handleMapSeq(AMapSeqUpdateStmCG node) @@ -275,7 +279,7 @@ public List handleMapSeq(AMapSeqUpdateStmCG node) if (!invTypes.isEmpty()) { - ADefaultClassDeclCG enclosingClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG enclosingClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); if (enclosingClass == null) { @@ -287,7 +291,7 @@ public List handleMapSeq(AMapSeqUpdateStmCG node) /** * Updates to fields in record setters need to check if invariants checks are enabled */ - return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, invTrans.getRecInfo()); + return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, decorator.getRecInfo()); } } @@ -304,7 +308,7 @@ public List handleVarDecl(AVarDeclCG node) if (!invTypes.isEmpty()) { - String name = invTrans.getJmlGen().getUtil().getName(node.getPattern()); + String name = decorator.getJmlGen().getUtil().getName(node.getPattern()); if (name == null) { @@ -324,7 +328,7 @@ public List handleVarDecl(AVarDeclCG node) * We do not really need to check if invariant checks are enabled because local variable declarations are * not expected to be found inside record accessors */ - return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, invTrans.getRecInfo()); + return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, decorator.getRecInfo()); } return null; @@ -362,7 +366,7 @@ public List handleCallObj(ACallObjectExpStmCG node) if (!invTypes.isEmpty()) { - ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) { @@ -373,7 +377,7 @@ public List handleCallObj(ACallObjectExpStmCG node) * Since setter calls can occur inside a record in the context of an atomic statement blocks we need to * check if invariant checks are enabled */ - return util.consAssertStm(invTypes, encClass.getName(), recObjVar, node, invTrans.getRecInfo()); + return util.consAssertStm(invTypes, encClass.getName(), recObjVar, node, decorator.getRecInfo()); } } else @@ -411,7 +415,7 @@ public void handleAssign(AAssignToExpStmCG node) if (!invTypes.isEmpty()) { - ADefaultClassDeclCG encClass = invTrans.getJmlGen().getUtil().getEnclosingClass(node); + ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); if (encClass == null) { @@ -422,7 +426,7 @@ public void handleAssign(AAssignToExpStmCG node) * Since assignments can occur inside record setters in the context of an atomic statement block we need to * check if invariant checks are enabled */ - List asserts = util.consAssertStm(invTypes, encClass.getName(), var, node, invTrans.getRecInfo()); + List asserts = util.consAssertStm(invTypes, encClass.getName(), var, node, decorator.getRecInfo()); for(AMetaStmCG a : asserts) { @@ -469,17 +473,17 @@ public ABlockStmCG getEncBlockStm(AVarDeclCG varDecl) private TransAssistantCG getTransAssist() { - return invTrans.getJmlGen().getJavaGen().getTransAssistant(); + return decorator.getJmlGen().getJavaGen().getTransAssistant(); } private IRInfo getInfo() { - return invTrans.getJmlGen().getJavaGen().getInfo(); + return decorator.getJmlGen().getJavaGen().getInfo(); } public JmlGenerator getJmlGen() { - return invTrans.getJmlGen(); + return decorator.getJmlGen(); } public List consAsserts(AIdentifierVarExpCG var) @@ -491,7 +495,7 @@ public List consAsserts(AIdentifierVarExpCG var) return null; } - ADefaultClassDeclCG encClass = invTrans.getStateDesInfo().getEnclosingClass(var); + ADefaultClassDeclCG encClass = decorator.getStateDesInfo().getEnclosingClass(var); if (encClass == null) { @@ -502,7 +506,7 @@ public List consAsserts(AIdentifierVarExpCG var) * Normalisation of state designators will never occur inside record classes so really there is no need to check * if invariant checks are enabled */ - return util.consAssertStm(invTypes, encClass.getName(), var, var, invTrans.getRecInfo()); + return util.consAssertStm(invTypes, encClass.getName(), var, var, decorator.getRecInfo()); } public boolean rightHandSideMayBeNull(SExpCG exp) @@ -533,9 +537,9 @@ private boolean treatMethod(INode node) // Some of the record methods inherited from object use native java type that can never be null - if(invTrans.getRecInfo().inRec(node)) + if(decorator.getRecInfo().inRec(node)) { - if(!(invTrans.getRecInfo().inAccessor(node) || invTrans.getRecInfo().inRecConstructor(node))) + if(!(decorator.getRecInfo().inAccessor(node) || decorator.getRecInfo().inRecConstructor(node))) { return false; } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java similarity index 92% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index d36754218a..4368c982ba 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen; import java.util.LinkedList; import java.util.List; @@ -17,12 +17,19 @@ import org.overture.codegen.cgast.types.AUnionTypeCG; import org.overture.codegen.cgast.types.AUnknownTypeCG; import org.overture.codegen.logging.Logger; +import org.overture.codegen.vdm2jml.JmlGenUtil; +import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.data.RecClassInfo; +import org.overture.codegen.vdm2jml.predgen.info.AbstractTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; -public class NamedTypeInvUtil +public class TypePredUtil { - private NamedTypeInvHandler handler; + private TypePredHandler handler; - public NamedTypeInvUtil(NamedTypeInvHandler handler) + public TypePredUtil(TypePredHandler handler) { this.handler = handler; } @@ -33,7 +40,7 @@ public List consJmlCheck(String enclosingClass, String jmlVisibility, { List predStrs = new LinkedList<>(); - if(handler.getInvAssertTrans().buildRecValidChecks()) + if(handler.getDecorator().buildRecValidChecks()) { appendRecValidChecks(invChecksGuard, typeInfoMatches, var, predStrs); } @@ -201,12 +208,6 @@ public AMetaStmCG consVarNotNullAssert(String varName) return assertStm; } -// public List consValNotNullInvariant(String fieldName) -// { -// return handler.getJmlGen().getAnnotator().consMetaData("//@ static invariant " + fieldName + " != null;"); -// } - - public List findTypeInfo(STypeCG type) { List posTypes = new LinkedList<>(); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AbstractTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java similarity index 91% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AbstractTypeInfo.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java index af433506a4..3e2774b686 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/AbstractTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen.info; import java.util.List; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java similarity index 97% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java index 7d18c011bf..4ee8c0e6c9 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen.info; import java.util.HashMap; import java.util.LinkedList; @@ -19,6 +19,7 @@ import org.overture.codegen.logging.Logger; import org.overture.codegen.runtime.Utils; import org.overture.codegen.vdm2java.JavaQuoteValueCreator; +import org.overture.codegen.vdm2jml.JmlGenUtil; public class LeafTypeInfo extends AbstractTypeInfo { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java similarity index 98% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInfo.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java index c82c72a91f..e72f4a723d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java @@ -1,8 +1,10 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen.info; import java.util.LinkedList; import java.util.List; +import org.overture.codegen.vdm2jml.JmlGenerator; + public class NamedTypeInfo extends AbstractTypeInfo { private String typeName; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java similarity index 98% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index db950e896b..9bde53d72d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.predgen.info; import java.util.HashSet; import java.util.LinkedList; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecAccessorTrans.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecAccessorTrans.java similarity index 98% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecAccessorTrans.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecAccessorTrans.java index 748e166630..7185ce628d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecAccessorTrans.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecAccessorTrans.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.trans; import java.util.LinkedList; import java.util.List; @@ -23,6 +23,8 @@ import org.overture.codegen.cgast.types.AVoidTypeCG; import org.overture.codegen.ir.IRConstants; import org.overture.codegen.vdm2java.JavaValueSemantics; +import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.data.RecClassInfo; public class RecAccessorTrans extends DepthFirstAnalysisAdaptor { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecInvTransformation.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecInvTransformation.java similarity index 99% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecInvTransformation.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecInvTransformation.java index 6e0bd3673c..5c0a61244d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/RecInvTransformation.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecInvTransformation.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.trans; import org.overture.ast.definitions.SFunctionDefinition; import org.overture.ast.definitions.SOperationDefinition; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/TargetNormaliserTrans.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/TargetNormaliserTrans.java similarity index 97% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/TargetNormaliserTrans.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/TargetNormaliserTrans.java index fd65f2eab9..0057039e6a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/TargetNormaliserTrans.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/TargetNormaliserTrans.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.trans; import java.util.LinkedList; import java.util.List; @@ -22,6 +22,8 @@ import org.overture.codegen.ir.ITempVarGen; import org.overture.codegen.logging.Logger; import org.overture.codegen.trans.assistants.TransAssistantCG; +import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.data.StateDesInfo; public class TargetNormaliserTrans extends DepthFirstAnalysisAdaptor { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IsValChecker.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java similarity index 97% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IsValChecker.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java index 9c26415165..7a5bf9139f 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IsValChecker.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.util; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.analysis.AnalysisException; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NameGen.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/NameGen.java similarity index 96% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NameGen.java rename to core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/NameGen.java index 28ea2ed417..6123d7d26d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/NameGen.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/NameGen.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.codegen.vdm2jml.util; import java.util.HashSet; import java.util.Set; diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlOutputTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlOutputTests.java index ea015896e7..c17378c36d 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlOutputTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlOutputTests.java @@ -15,6 +15,8 @@ import org.junit.runners.Parameterized.Parameters; import org.overture.codegen.utils.GeneralUtils; import org.overture.test.framework.Properties; +import org.overture.vdm2jml.tests.exec.JmlExecTestBase; +import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) public class JmlOutputTests extends JmlGenTestBase diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPassTypeCheckTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPassTypeCheckTests.java index fe90e26dc5..9dafd5f853 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPassTypeCheckTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPassTypeCheckTests.java @@ -13,8 +13,9 @@ import org.overture.codegen.utils.GeneralUtils; import org.overture.codegen.vdm2java.JavaCodeGenUtil; import org.overture.codegen.vdm2java.JavaToolsUtils; -import org.overture.codegen.vdm2jml.IOpenJmlConsts; +import org.overture.vdm2jml.tests.util.IOpenJmlConsts; import org.overture.vdm2jml.tests.util.ProcessResult; +import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) public class JmlPassTypeCheckTests extends OpenJmlValidationBase diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java index b749cec833..48a849e019 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java @@ -17,7 +17,7 @@ import org.overture.codegen.cgast.types.ARecordTypeCG; import org.overture.codegen.cgast.types.ATokenBasicTypeCG; import org.overture.codegen.runtime.Utils; -import org.overture.codegen.vdm2jml.LeafTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; public class LeafTypeCallTests { diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java index 9f3a0246c6..3be3cbdc0d 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java @@ -3,6 +3,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.overture.ast.analysis.AnalysisException; +import org.overture.vdm2jml.tests.util.Update; public class ModuleStateInvComplexTests extends AnnotationTestsBase { diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java index 6881d21a85..99aed82910 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java @@ -10,6 +10,7 @@ import org.overture.codegen.cgast.declarations.AMethodDeclCG; import org.overture.codegen.cgast.statements.AMetaStmCG; import org.overture.vdm2jml.tests.util.TestDataCollector; +import org.overture.vdm2jml.tests.util.Update; public class ModuleStateInvTests extends AnnotationTestsBase { diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/NameGenTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/NameGenTests.java index 39a4f63a80..1774d28cd6 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/NameGenTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/NameGenTests.java @@ -5,7 +5,7 @@ import org.junit.Test; import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; -import org.overture.codegen.vdm2jml.NameGen; +import org.overture.codegen.vdm2jml.util.NameGen; public class NameGenTests { diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OpenJmlValidationBase.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OpenJmlValidationBase.java index e67052fe48..c74ace3c31 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OpenJmlValidationBase.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OpenJmlValidationBase.java @@ -9,10 +9,11 @@ import org.overture.codegen.logging.Logger; import org.overture.codegen.utils.GeneralUtils; import org.overture.vdm2jml.tests.util.ProcessResult; +import org.overture.vdm2jml.tests.util.TestUtil; abstract public class OpenJmlValidationBase extends JmlGenTestBase { - protected static final String VDMSL_FILE_EXT = ".vdmsl"; + public static final String VDMSL_FILE_EXT = ".vdmsl"; public static final String OPENJML_ENV_VAR = "OPENJML"; diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java index 0760b2fd4d..908d40256c 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java @@ -11,9 +11,9 @@ import org.overture.codegen.cgast.types.ANatNumericBasicTypeCG; import org.overture.codegen.utils.GeneralCodeGenUtils; import org.overture.codegen.vdm2jml.JmlGenerator; -import org.overture.codegen.vdm2jml.LeafTypeInfo; -import org.overture.codegen.vdm2jml.NamedTypeInfo; -import org.overture.codegen.vdm2jml.NamedTypeInvDepCalculator; +import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; import org.overture.typechecker.util.TypeCheckerUtil; import org.overture.typechecker.util.TypeCheckerUtil.TypeCheckResult; diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlAtomicExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlAtomicExecTests.java similarity index 89% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlAtomicExecTests.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlAtomicExecTests.java index 4fcdca752c..0c317a0e96 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlAtomicExecTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlAtomicExecTests.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.exec; import java.io.File; import java.util.Collection; @@ -7,6 +7,7 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) public class JmlAtomicExecTests extends JmlExecTestBase diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlComplexStateDesExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComplexStateDesExecTests.java similarity index 90% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlComplexStateDesExecTests.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComplexStateDesExecTests.java index fb23dd51e0..cfeb5f996a 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlComplexStateDesExecTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComplexStateDesExecTests.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.exec; import java.io.File; import java.util.Collection; @@ -7,6 +7,7 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) public class JmlComplexStateDesExecTests extends JmlExecTestBase diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlExecTestBase.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java similarity index 96% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlExecTestBase.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java index 942491b7be..95b66517d2 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlExecTestBase.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.exec; import java.io.File; import java.io.FileNotFoundException; @@ -19,9 +19,12 @@ import org.overture.codegen.vdm2java.IJavaConstants; import org.overture.codegen.vdm2java.JavaCodeGenUtil; import org.overture.codegen.vdm2java.JavaToolsUtils; -import org.overture.codegen.vdm2jml.IOpenJmlConsts; import org.overture.test.framework.Properties; +import org.overture.vdm2jml.tests.AnnotationTestsBase; +import org.overture.vdm2jml.tests.OpenJmlValidationBase; +import org.overture.vdm2jml.tests.util.IOpenJmlConsts; import org.overture.vdm2jml.tests.util.ProcessResult; +import org.overture.vdm2jml.tests.util.TestUtil; public abstract class JmlExecTestBase extends OpenJmlValidationBase { diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlNamedTypeInvExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlNamedTypeInvExecTests.java similarity index 89% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlNamedTypeInvExecTests.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlNamedTypeInvExecTests.java index 248d60496d..0d142ab724 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlNamedTypeInvExecTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlNamedTypeInvExecTests.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.exec; import java.io.File; import java.util.Collection; @@ -7,6 +7,7 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) public class JmlNamedTypeInvExecTests extends JmlExecTestBase diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPrePostExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlPrePostExecTests.java similarity index 89% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPrePostExecTests.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlPrePostExecTests.java index 2290eec42f..8ed93b1174 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPrePostExecTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlPrePostExecTests.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.exec; import java.io.File; import java.util.Collection; @@ -7,6 +7,7 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) public class JmlPrePostExecTests extends JmlExecTestBase diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlRecInvExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlRecInvExecTests.java similarity index 89% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlRecInvExecTests.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlRecInvExecTests.java index ceb0b57577..8d17f978f3 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlRecInvExecTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlRecInvExecTests.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.exec; import java.io.File; import java.util.Collection; @@ -7,6 +7,7 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) public class JmlRecInvExecTests extends JmlExecTestBase diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OptionalTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/OptionalTypeExecTests.java similarity index 89% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OptionalTypeExecTests.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/OptionalTypeExecTests.java index c9f3d03a35..5738452f4e 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OptionalTypeExecTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/OptionalTypeExecTests.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.exec; import java.io.File; import java.util.Collection; @@ -7,6 +7,7 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) public class OptionalTypeExecTests extends JmlExecTestBase diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IOpenJmlConsts.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/IOpenJmlConsts.java similarity index 88% rename from core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IOpenJmlConsts.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/IOpenJmlConsts.java index 325c3de956..0a4290656c 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/IOpenJmlConsts.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/IOpenJmlConsts.java @@ -1,4 +1,4 @@ -package org.overture.codegen.vdm2jml; +package org.overture.vdm2jml.tests.util; public interface IOpenJmlConsts { diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TestUtil.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/TestUtil.java similarity index 93% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TestUtil.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/TestUtil.java index 9c1a7af60c..4063e89bf1 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TestUtil.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/TestUtil.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.util; import java.io.File; import java.util.Collection; @@ -9,6 +9,8 @@ import org.overture.codegen.vdm2java.IJavaConstants; import org.overture.codegen.vdm2java.JavaCodeGen; import org.overture.codegen.vdm2jml.JmlGenMain; +import org.overture.vdm2jml.tests.OpenJmlValidationBase; +import org.overture.vdm2jml.tests.exec.JmlExecTestBase; public class TestUtil { diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/Update.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/Update.java similarity index 58% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/Update.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/Update.java index 7821bb15cb..0599d4b5b5 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/Update.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/util/Update.java @@ -1,4 +1,4 @@ -package org.overture.vdm2jml.tests; +package org.overture.vdm2jml.tests.util; public enum Update { From 368648373923a5ec385e3dc8cc7a5194f6ef7d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 18:16:59 +0200 Subject: [PATCH 104/706] Setup execution test for checking of basic types --- .../tests/exec/JmlBasicTypeExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlBasicTypeExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlBasicTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlBasicTypeExecTests.java new file mode 100644 index 0000000000..3710d59df7 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlBasicTypeExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlBasicTypeExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "basictype"; + + public static final String PROPERTY_ID = "basictype"; + + public JmlBasicTypeExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From 4b8b16b4d34e9fbb015cd03c50afe2f19abce2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 18:17:29 +0200 Subject: [PATCH 105/706] Add test to exercise checking of bool types --- .../BoolReturnNil/BoolReturnNil.vdmsl | 30 ++++++++++++ .../BoolReturnNil/BoolReturnNil.vdmsl.result | 7 +++ .../basictype/BoolReturnNil/Entry.java | 49 +++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl new file mode 100644 index 0000000000..f5567772a5 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl @@ -0,0 +1,30 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + dcl b : bool; + IO`println("Before valid use."); + b := true; + IO`println("After valid use."); + IO`println("Before invalid use."); + b := boolNil(); + IO`println("After invalid use."); + return 0; +); + +functions + +boolTrue : () -> bool +boolTrue () == true; + +boolNil : () -> [bool] +boolNil () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl.result new file mode 100644 index 0000000000..e8eec9e41c --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:24: JML assertion is false + //@ assert Utils.is_bool(b); + ^ +"After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java new file mode 100644 index 0000000000..0ddcd0c350 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java @@ -0,0 +1,49 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Boolean b = false; + //@ assert Utils.is_bool(b); + IO.println("Before valid use."); + b = true; + //@ assert Utils.is_bool(b); + IO.println("After valid use."); + IO.println("Before invalid use."); + b = boolNil(); + //@ assert Utils.is_bool(b); + IO.println("After invalid use."); + + return 0L; + } + + /*@ pure @*/ + public static Boolean boolTrue() { + Boolean ret_1 = true; + + //@ assert Utils.is_bool(ret_1); + return ret_1; + } + + /*@ pure @*/ + public static Boolean boolNil() { + Boolean ret_2 = null; + + //@ assert (ret_2 == null || Utils.is_bool(ret_2)); + return ret_2; + } + + public String toString() { + return "Entry{}"; + } +} From 3e4c9c8b16876bd7fd667b23be7e56d2654dfc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 18:22:57 +0200 Subject: [PATCH 106/706] Add test to exercise checking of the nat type --- .../basictype/NatParamNil/Entry.java | 44 +++++++++++++++++++ .../basictype/NatParamNil/NatParamNil.vdmsl | 28 ++++++++++++ .../NatParamNil/NatParamNil.vdmsl.result | 10 +++++ 3 files changed, 82 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java new file mode 100644 index 0000000000..1dc36f951c --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java @@ -0,0 +1,44 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Number n = 0L; + //@ assert (n == null || Utils.is_nat(n)); + IO.println("Before valid use."); + n = 1L; + //@ assert (n == null || Utils.is_nat(n)); + n = null; + //@ assert (n == null || Utils.is_nat(n)); + IO.println("After valid use."); + IO.println("Before invalid use."); + n = idNat(n); + //@ assert (n == null || Utils.is_nat(n)); + IO.println("After invalid use."); + + return 0L; + } + + /*@ pure @*/ + public static Number idNat(final Number x) { + //@ assert Utils.is_nat(x); + Number ret_1 = x; + + //@ assert Utils.is_nat(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl new file mode 100644 index 0000000000..c4fce59735 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl @@ -0,0 +1,28 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + dcl n : [nat] := 0; + IO`println("Before valid use."); + n := 1; + n := nil; + IO`println("After valid use."); + IO`println("Before invalid use."); + n := idNat(n); + IO`println("After invalid use."); + return 0; +); + +functions + +idNat : nat -> nat +idNat (x) == x; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl.result new file mode 100644 index 0000000000..9765d810e2 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl.result @@ -0,0 +1,10 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:34: JML assertion is false + //@ assert Utils.is_nat(x); + ^ +Entry.java:37: JML assertion is false + //@ assert Utils.is_nat(ret_1); + ^ +"After invalid use." \ No newline at end of file From 1eb9e67174d82a99390f049702e472084f2775f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 18:33:53 +0200 Subject: [PATCH 107/706] Test checking of nat1 --- .../basictype/Nat1InitWithZero/Entry.java | 40 +++++++++++++++++++ .../Nat1InitWithZero/Nat1InitWithZero.vdmsl | 22 ++++++++++ .../Nat1InitWithZero.vdmsl.result | 7 ++++ 3 files changed, 69 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Entry.java new file mode 100644 index 0000000000..de1c3d5ebf --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Entry.java @@ -0,0 +1,40 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Number n = 1L; + //@ assert Utils.is_nat1(n); + IO.println("Before valid use."); + n = 1L; + //@ assert Utils.is_nat1(n); + IO.println("After valid use."); + IO.println("Before invalid use."); + + { + Number n1 = 0L; + + //@ assert Utils.is_nat1(n1); + + /* skip */ + } + + IO.println("After invalid use."); + + return 0L; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl new file mode 100644 index 0000000000..504745bb4a --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl @@ -0,0 +1,22 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + dcl n : nat1 := 1; + IO`println("Before valid use."); + n := 1; + IO`println("After valid use."); + IO`println("Before invalid use."); + (dcl n1 : nat1 := 0; skip); + IO`println("After invalid use."); + return 0; +); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl.result new file mode 100644 index 0000000000..41bc1d7b9e --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:27: JML assertion is false + //@ assert Utils.is_nat1(n1); + ^ +"After invalid use." \ No newline at end of file From 0314c380ccbdcbe24a19eceb49e5955d4b7c2e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 18:38:43 +0200 Subject: [PATCH 108/706] Test checking of the int type --- .../basictype/IntAssignNonInt/Entry.java | 33 +++++++++++++++++++ .../IntAssignNonInt/IntAssignNonInt.vdmsl | 22 +++++++++++++ .../IntAssignNonInt.vdmsl.result | 7 ++++ 3 files changed, 62 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/Entry.java new file mode 100644 index 0000000000..1dfe06f7cc --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/Entry.java @@ -0,0 +1,33 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Number i = -1L; + //@ assert Utils.is_int(i); + IO.println("Before valid use."); + i = 1L; + //@ assert Utils.is_int(i); + IO.println("After valid use."); + IO.println("Before invalid use."); + i = i.longValue() + 0.5; + //@ assert Utils.is_int(i); + IO.println("After invalid use."); + + return 0L; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl new file mode 100644 index 0000000000..3b90ce4884 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl @@ -0,0 +1,22 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + dcl i : int := -1; + IO`println("Before valid use."); + i := 1; + IO`println("After valid use."); + IO`println("Before invalid use."); + i := i + 0.5; + IO`println("After invalid use."); + return 0; +); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl.result new file mode 100644 index 0000000000..93fbf2d905 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:24: JML assertion is false + //@ assert Utils.is_int(i); + ^ +"After invalid use." \ No newline at end of file From c0f42f5f135e29914cef0ea06c5ddc97169d47fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 19:50:11 +0200 Subject: [PATCH 109/706] Updates to test results related to Java generation of union types --- .../union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result | 2 +- .../resources/union_type_specs/FieldExpOfRecord.vdmpp.result | 2 +- .../union_type_specs/UnknownTypeInUnionType.vdmpp.result | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result index 8b6f6feb24..9cb2982beb 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result @@ -37,7 +37,7 @@ public class Entry { Rec apply_1 = null; if (obj_1 instanceof Entry) { - apply_1 = ((Entry) obj_1).x; + apply_1 = ((Rec) ((Entry) obj_1).x); } else { throw new RuntimeException("Missing member: x"); } diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpOfRecord.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpOfRecord.vdmpp.result index 6d4462e78e..39f7694763 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpOfRecord.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpOfRecord.vdmpp.result @@ -28,7 +28,7 @@ public class Entry { Number apply_1 = null; if (obj_1 instanceof Rec) { - apply_1 = ((Rec) obj_1).x; + apply_1 = ((Number) ((Rec) obj_1).x); } else { throw new RuntimeException("Missing member: x"); } diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/UnknownTypeInUnionType.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/UnknownTypeInUnionType.vdmpp.result index 160668a258..2cae88ece7 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/UnknownTypeInUnionType.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/UnknownTypeInUnionType.vdmpp.result @@ -27,7 +27,7 @@ public class Entry { Number apply_1 = null; if (obj_1 instanceof Entry) { - apply_1 = ((Entry) obj_1).x; + apply_1 = ((Number) ((Entry) obj_1).x); } else { throw new RuntimeException("Missing member: x"); } From 6402951fa69ca82b2554ff46209f1e77f77ed736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 19:51:22 +0200 Subject: [PATCH 110/706] Add test revealing problem with Java code generation of union types --- .../AssignUnionTypeFuncReturn.vdmpp | 18 +++++++++++++ ...ssignUnionTypeFuncReturn.vdmpp.eval.result | 6 +++++ .../AssignUnionTypeFuncReturn.vdmpp.result | 27 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp create mode 100644 core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp.eval.result create mode 100644 core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp.result diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp b/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp new file mode 100644 index 0000000000..f80cf6f4cc --- /dev/null +++ b/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp @@ -0,0 +1,18 @@ +class Entry + +operations + +public static Run : () ==> ? +Run () == +( + dcl i : rat := 123.456; + i := ratOrBool(); + return i; +); + +functions + +ratOrBool : () -> rat | bool +ratOrBool () == 5; + +end Entry \ No newline at end of file diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp.eval.result b/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp.eval.result new file mode 100644 index 0000000000..4ccc954445 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp.eval.result @@ -0,0 +1,6 @@ + + + + + + diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp.result new file mode 100644 index 0000000000..5048ad31a4 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/union_type_specs/AssignUnionTypeFuncReturn.vdmpp.result @@ -0,0 +1,27 @@ +import org.overture.codegen.runtime.*; + +import java.util.*; + + +@SuppressWarnings("all") +public class Entry { + public Entry() { + } + + public static Object Run() { + Number i = 123.456; + i = ((Number) ratOrBool()); + + return i; + } + + private static Object ratOrBool() { + return 5L; + } + + public String toString() { + return "Entry{}"; + } +} + +########## From d4a6f8346187a86d020ec3faa35f86788b1a83ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 19:52:50 +0200 Subject: [PATCH 111/706] Fix for Java code generation of union types The 'assignment' case was missing --- .../trans/uniontypes/UnionTypeTrans.java | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java index 8aa04de3e1..d87044d7f3 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java @@ -847,16 +847,38 @@ private ARaiseErrorStmCG consRaiseStm(String prefix, String fieldName) public void inAVarDeclCG(AVarDeclCG node) throws AnalysisException { - STypeCG expectedType = node.getType(); - - if(expectedType instanceof AUnknownTypeCG || node.getExp() instanceof ANullExpCG) + if(node.getExp() != null) + { + node.getExp().apply(this); + } + + if(node.getType() instanceof AUnknownTypeCG || node.getExp() instanceof ANullExpCG) { return; } - if (!(expectedType instanceof AUnionTypeCG)) + if (!(node.getType() instanceof AUnionTypeCG)) { - correctTypes(node.getExp(), expectedType); + correctTypes(node.getExp(), node.getType()); + } + } + + @Override + public void caseAAssignToExpStmCG(AAssignToExpStmCG node) throws AnalysisException + { + if(node.getExp() != null) + { + node.getExp().apply(this); + } + + if(node.getTarget().getType() instanceof AUnknownTypeCG || node.getExp() instanceof ANullExpCG) + { + return; + } + + if (!(node.getTarget().getType() instanceof AUnionTypeCG)) + { + correctTypes(node.getExp(), node.getTarget().getType()); } } From d2a024b8cbdeb13f3fc06d3688aa1a038f00a0a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 20:02:12 +0200 Subject: [PATCH 112/706] Add test to exercise handling of rational numbers --- .../basictype/RatAssignBool/Entry.java | 41 +++++++++++++++++++ .../RatAssignBool/RatAssignBool.vdmsl | 27 ++++++++++++ .../RatAssignBool/RatAssignBool.vdmsl.result | 7 ++++ 3 files changed, 75 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java new file mode 100644 index 0000000000..28e431711d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java @@ -0,0 +1,41 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Number i = 123.456; + //@ assert Utils.is_rat(i); + IO.println("Before valid use."); + i = i.doubleValue() * i.doubleValue(); + //@ assert Utils.is_rat(i); + IO.println("After valid use."); + IO.println("Before invalid use."); + i = ratOpt(); + //@ assert Utils.is_rat(i); + IO.println("After invalid use."); + + return 0L; + } + + /*@ pure @*/ + public static Number ratOpt() { + Number ret_1 = null; + + //@ assert (ret_1 == null || Utils.is_rat(ret_1)); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl new file mode 100644 index 0000000000..aef17721b2 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl @@ -0,0 +1,27 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + dcl i : rat := 123.456; + IO`println("Before valid use."); + i := i * i; + IO`println("After valid use."); + IO`println("Before invalid use."); + i := ratOpt(); + IO`println("After invalid use."); + return 0; +); + +functions + +ratOpt : () -> [rat] +ratOpt () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl.result new file mode 100644 index 0000000000..d7b24eb63d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:24: JML assertion is false + //@ assert Utils.is_rat(i); + ^ +"After invalid use." \ No newline at end of file From 5f3968282ac161f5d15344d072f1caf7ac6c3c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 21:13:30 +0200 Subject: [PATCH 113/706] Test checking of reals --- .../basictype/RealParamNil/Entry.java | 39 +++++++++++++++++++ .../basictype/RealParamNil/RealParamNil.vdmsl | 27 +++++++++++++ .../RealParamNil/RealParamNil.vdmsl.result | 7 ++++ 3 files changed, 73 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java new file mode 100644 index 0000000000..fb6cccfa48 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java @@ -0,0 +1,39 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Number r = 1.23; + //@ assert (r == null || Utils.is_real(r)); + IO.println("Before valid use."); + doSkip(r); + r = null; + //@ assert (r == null || Utils.is_real(r)); + IO.println("After valid use."); + IO.println("Before invalid use."); + doSkip(r); + IO.println("After invalid use."); + + return 0L; + } + + public static void doSkip(final Number ignorePattern_1) { + //@ assert Utils.is_real(ignorePattern_1); + + /* skip */ + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl new file mode 100644 index 0000000000..46c5edd9c8 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl @@ -0,0 +1,27 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +(dcl r : [real] := 1.23; + IO`println("Before valid use."); + doSkip(r); + r := nil; + IO`println("After valid use."); + IO`println("Before invalid use."); + doSkip(r); + IO`println("After invalid use."); + return 0; +); + +operations + +doSkip : real ==> () +doSkip (-) == skip; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl.result new file mode 100644 index 0000000000..b55957f217 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:31: JML assertion is false + //@ assert Utils.is_real(ignorePattern_1); + ^ +"After invalid use." \ No newline at end of file From 3951c534dbb58123109afa8b06ae78ac7baa2490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 21:34:43 +0200 Subject: [PATCH 114/706] Test checking of chars --- .../CharReturnNil/CharReturnNil.vdmsl | 29 +++++++++ .../CharReturnNil/CharReturnNil.vdmsl.result | 7 +++ .../basictype/CharReturnNil/Entry.java | 61 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl new file mode 100644 index 0000000000..850ca762e9 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl @@ -0,0 +1,29 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before valid use."); + let - : char = charA() in skip; + IO`println("After valid use."); + IO`println("Before invalid use."); + let - : char = charNil() in skip; + IO`println("After invalid use."); + return 0; +); + +functions + +charA : () -> [char] +charA () == 'a'; + +charNil : () -> [char] +charNil () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl.result new file mode 100644 index 0000000000..4ed8da7b17 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:32: JML assertion is false + //@ assert Utils.is_char(ignorePattern_2); + ^ +"After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java new file mode 100644 index 0000000000..378785eade --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java @@ -0,0 +1,61 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before valid use."); + + { + Character ignorePattern_1 = charA(); + + //@ assert Utils.is_char(ignorePattern_1); + + /* skip */ + } + + IO.println("After valid use."); + IO.println("Before invalid use."); + + { + Character ignorePattern_2 = charNil(); + + //@ assert Utils.is_char(ignorePattern_2); + + /* skip */ + } + + IO.println("After invalid use."); + + return 0L; + } + + /*@ pure @*/ + public static Character charA() { + Character ret_1 = 'a'; + + //@ assert (ret_1 == null || Utils.is_char(ret_1)); + return ret_1; + } + + /*@ pure @*/ + public static Character charNil() { + Character ret_2 = null; + + //@ assert (ret_2 == null || Utils.is_char(ret_2)); + return ret_2; + } + + public String toString() { + return "Entry{}"; + } +} From cd5389b61ed611793be5feec77ff2b4ecbad21e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 21:47:25 +0200 Subject: [PATCH 115/706] Test checking of tokens --- .../basictype/TokenAssignNil/Entry.java | 52 +++++++++++++++++++ .../TokenAssignNil/TokenAssignNil.vdmsl | 26 ++++++++++ .../TokenAssignNil.vdmsl.result | 7 +++ 3 files changed, 85 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java new file mode 100644 index 0000000000..d2e589d15a --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java @@ -0,0 +1,52 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + //@ public static invariant (n == null || Utils.is_token(n)); + public static final Token n = null; + + //@ public static invariant (t == null || Utils.is_token(t)); + public static final Token t = new Token(""); + + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before valid use."); + + { + Token ignorePattern_1 = t; + + //@ assert Utils.is_token(ignorePattern_1); + + /* skip */ + } + + IO.println("After valid use."); + IO.println("Before invalid use."); + + { + Token ignorePattern_2 = n; + + //@ assert Utils.is_token(ignorePattern_2); + + /* skip */ + } + + IO.println("After invalid use."); + + return 0L; + } + + public String toString() { + return "Entry{" + "n = " + Utils.toString(n) + ", t = " + + Utils.toString(t) + "}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl new file mode 100644 index 0000000000..7bd461b86f --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl @@ -0,0 +1,26 @@ +module Entry + +exports all +imports from IO all +definitions + +values + +n : [token] = nil; +t : [token] = mk_token(""); + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before valid use."); + let - : token = t in skip; + IO`println("After valid use."); + IO`println("Before invalid use."); + let - : token = n in skip; + IO`println("After invalid use."); + return 0; +); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl.result new file mode 100644 index 0000000000..00fb4a6df3 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:38: JML assertion is false + //@ assert Utils.is_token(ignorePattern_2); + ^ +"After invalid use." \ No newline at end of file From 7e68e5ee77c5d6c6a858a44747ac57ffb60719bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 22:28:48 +0200 Subject: [PATCH 116/706] Test checking quote types --- .../basictype/QuoteAssignNil/Entry.java | 53 +++++++++++++++++++ .../QuoteAssignNil/QuoteAssignNil.vdmsl | 26 +++++++++ .../QuoteAssignNil.vdmsl.result | 7 +++ 3 files changed, 86 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java new file mode 100644 index 0000000000..43ab29fab1 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java @@ -0,0 +1,53 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before valid use."); + + { + project.quotes.AQuote aOpt = null; + + //@ assert (aOpt == null || Utils.is_(aOpt,project.quotes.AQuote.class)); + + /* skip */ + } + + IO.println("After valid use."); + IO.println("Before invalid use."); + + { + project.quotes.AQuote a = Nil(); + + //@ assert Utils.is_(a,project.quotes.AQuote.class); + + /* skip */ + } + + IO.println("After invalid use."); + + return 0L; + } + + /*@ pure @*/ + public static project.quotes.AQuote Nil() { + project.quotes.AQuote ret_1 = null; + + //@ assert (ret_1 == null || Utils.is_(ret_1,project.quotes.AQuote.class)); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl new file mode 100644 index 0000000000..f58b50d071 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl @@ -0,0 +1,26 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before valid use."); + (dcl aOpt : [] := nil;skip); + IO`println("After valid use."); + IO`println("Before invalid use."); + (dcl a : := Nil(); skip); + IO`println("After invalid use."); + return 0; +); + +functions + +Nil : () -> [] +Nil () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl.result new file mode 100644 index 0000000000..8943dc678d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use." +"After valid use." +"Before invalid use." +Entry.java:32: JML assertion is false + //@ assert Utils.is_(a,project.quotes.AQuote.class); + ^ +"After invalid use." \ No newline at end of file From 9d61981654faf0f66802829673e2c38db88e9972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 22:38:51 +0200 Subject: [PATCH 117/706] Missing cases in the value checker --- .../codegen/vdm2jml/util/IsValChecker.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java index 7a5bf9139f..8583f364e5 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java @@ -4,8 +4,11 @@ import org.overture.codegen.cgast.analysis.AnalysisException; import org.overture.codegen.cgast.analysis.AnswerAdaptor; import org.overture.codegen.cgast.expressions.AMinusUnaryExpCG; +import org.overture.codegen.cgast.expressions.AMkBasicExpCG; import org.overture.codegen.cgast.expressions.ANewExpCG; +import org.overture.codegen.cgast.expressions.ANullExpCG; import org.overture.codegen.cgast.expressions.APlusUnaryExpCG; +import org.overture.codegen.cgast.expressions.ATokenIsExpCG; import org.overture.codegen.cgast.expressions.SLiteralExpCG; import org.overture.codegen.cgast.expressions.SNumericBinaryExpCG; @@ -24,6 +27,19 @@ public Boolean defaultSLiteralExpCG(SLiteralExpCG node) throws AnalysisException return true; } + @Override + public Boolean caseAMkBasicExpCG(AMkBasicExpCG node) throws AnalysisException + { + // Token value + return true; + } + + @Override + public Boolean caseANullExpCG(ANullExpCG node) throws AnalysisException + { + return true; + } + @Override public Boolean caseANewExpCG(ANewExpCG node) throws AnalysisException { From 9d30629f86bf7abc655b95de4df4610eec218265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 10 Oct 2015 23:04:49 +0200 Subject: [PATCH 118/706] Removing wrong log message The message did not consider local variables introduced by the IR generator during the transformation process --- .../codegen/vdm2jml/trans/RecInvTransformation.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecInvTransformation.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecInvTransformation.java index 5c0a61244d..c5bc31fe6b 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecInvTransformation.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/trans/RecInvTransformation.java @@ -183,12 +183,6 @@ public void caseAIdentifierVarExpCG(AIdentifierVarExpCG node) + this.getClass().getSimpleName() + "'"); } } - } else - { - Logger.getLog().printErrorln("Expected vdm source node to be a variable expression at this point in '" - + this.getClass().getSimpleName() + "'. Got: " - + vdmNode); - } } } From 7cdf6ef4250e773598118a3ce454c0fa007f84ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 13:27:18 +0200 Subject: [PATCH 119/706] Add union types to the type info hierarchy --- .../vdm2jml/predgen/info/UnionInfo.java | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java new file mode 100644 index 0000000000..f4197f6ca5 --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java @@ -0,0 +1,125 @@ +package org.overture.codegen.vdm2jml.predgen.info; + +import java.util.LinkedList; +import java.util.List; + +import org.overture.codegen.vdm2jml.JmlGenerator; + +public class UnionInfo extends AbstractTypeInfo +{ + private List types; + + public UnionInfo(boolean optional) + { + super(optional); + this.types = new LinkedList<>(); + } + + public List getTypes() + { + return types; + } + + @Override + public boolean allowsNull() + { + if(optional) + { + return true; + } + + for(AbstractTypeInfo t : types) + { + if(t.allowsNull()) + { + return true; + } + } + + return false; + } + + @Override + public List getLeafTypesRecursively() + { + List leaves = new LinkedList<>(); + + for(AbstractTypeInfo t : types) + { + leaves.addAll(t.getLeafTypesRecursively()); + } + + return leaves; + } + + @Override + public boolean contains(AbstractTypeInfo subject) + { + //TODO: Returning false leads to redundant dynamic type check which is not optimal + return false; + } + + //TODO: eventually this must go out + private List removeDirectLeaves() + { + List filtered = new LinkedList<>(); + + for(AbstractTypeInfo t : types) + { + if(!(t instanceof LeafTypeInfo)) + { + filtered.add(t); + } + } + + return filtered; + } + + @Override + public String consCheckExp(String enclosingModule, String javaRootPackage) + { + //TODO: remove eventually + List types = removeDirectLeaves(); + + StringBuilder sb = new StringBuilder(); + + sb.append('('); + + String orSep = ""; + boolean allowsNull = allowsNull(); + if(allowsNull) + { + sb.append(ARG_PLACEHOLDER + " == null"); + orSep = JmlGenerator.JML_OR; + } + + for (AbstractTypeInfo n : types) + { + sb.append(orSep); + sb.append(n.consCheckExp(enclosingModule, javaRootPackage)); + orSep = JmlGenerator.JML_OR; + } + + sb.append(')'); + + return sb.toString(); + } + + @Override + public String toString() + { + StringBuilder sb = new StringBuilder(); + sb.append('('); + + String sep = ""; + for(AbstractTypeInfo t : types) + { + sb.append(sep); + sb.append(t.toString()); + sep = "|"; + } + + sb.append(')'); + return sb.toString(); + } +} From 2b1f6a83d2ea982bce4bad9bdeb18c750f8ece85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 13:28:36 +0200 Subject: [PATCH 120/706] Updated 'NamedTypeInfo' to support the new type info hierarchy --- .../vdm2jml/predgen/info/NamedTypeInfo.java | 184 ++++++------------ 1 file changed, 57 insertions(+), 127 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java index e72f4a723d..e5878f9970 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java @@ -10,17 +10,15 @@ public class NamedTypeInfo extends AbstractTypeInfo private String typeName; private String defModule; private boolean hasInv; - private List namedTypes; - private List leafTypes; - - public NamedTypeInfo(String typeName, String defModule, boolean hasInv, boolean optional) + private AbstractTypeInfo domainType; // T = + + public NamedTypeInfo(String typeName, String defModule, boolean hasInv, boolean optional, AbstractTypeInfo domainType) { super(optional); this.typeName = typeName; this.defModule = defModule; this.hasInv = hasInv; - this.namedTypes = new LinkedList(); - this.leafTypes = new LinkedList(); + this.domainType = domainType; } public String getTypeName() @@ -33,38 +31,31 @@ public String getDefModule() return defModule; } - public List getNamedTypes() - { - return namedTypes; - } - public boolean hasInv() { return hasInv; } - - public List getLeafTypes() - { - return leafTypes; - } - + public boolean contains(AbstractTypeInfo other) { - if (equals(other)) - { - return true; - } else - { - for (NamedTypeInfo n : namedTypes) - { - if (n.contains(other)) - { - return true; - } - } - } - + //TODO: Returning false leads to redundant dynamic type check which is not optimal return false; + +// if (equals(other)) +// { +// return true; +// } else +// { +// for (NamedTypeInfo n : namedTypes) +// { +// if (n.contains(other)) +// { +// return true; +// } +// } +// } +// +// return false; } @Override @@ -120,13 +111,14 @@ public static boolean isSameTypeDef(NamedTypeInfo typeData, return true; } + @Override public String consCheckExp(String enclosingModule, String javaRootPackages) { StringBuilder sb = new StringBuilder(); consCheckExp(sb, enclosingModule, javaRootPackages); return sb.toString(); } - + private void consCheckExp(StringBuilder sb, String enclosingModule, String javaRootPackage) { // // If the type is not defined in the enclosing class we use the absolute name @@ -148,117 +140,61 @@ private void consCheckExp(StringBuilder sb, String enclosingModule, String javaR sb.append(ARG_PLACEHOLDER); sb.append(')'); - boolean allowsNull = allowsNull(); - if (!namedTypes.isEmpty()) + if (domainType != null) { - sb.append(JmlGenerator.JML_AND); - - sb.append('('); - - String orSep = ""; - if(allowsNull) + //TODO: remvoe eventually + if(!onlyBasics()) { - sb.append(ARG_PLACEHOLDER + " == null"); - orSep = JmlGenerator.JML_OR; + sb.append(JmlGenerator.JML_AND); + sb.append(domainType.consCheckExp(enclosingModule, javaRootPackage)); + } - - for (NamedTypeInfo n : namedTypes) - { - sb.append(orSep); - n.consCheckExp(sb, enclosingModule, javaRootPackage); - orSep = JmlGenerator.JML_OR; - } - - sb.append(')'); } } - @Override - public String toString() + //TODO: REMOVE THIS + private boolean onlyBasics() { - StringBuilder sb = new StringBuilder(); - - sb.append("Module: "); - sb.append(defModule); - sb.append('\n'); - sb.append("Type name: "); - sb.append(typeName); - sb.append('\n'); - - sb.append("Name types: "); - if (!namedTypes.isEmpty()) + if(domainType instanceof LeafTypeInfo) { - String sep = ""; - for (NamedTypeInfo t : namedTypes) - { - sb.append(sep); - sb.append(t.getDefModule() + "." + t.getTypeName()); - sep = ", "; - } - } else - { - sb.append("None"); + return true; } - sb.append(".\n"); - - sb.append("Leaf types: "); - if (!leafTypes.isEmpty()) + + if(domainType instanceof UnionInfo) { - String sep = ""; - for (LeafTypeInfo leaf : leafTypes) + for(AbstractTypeInfo t : ((UnionInfo) domainType).getTypes()) { - sb.append(sep); - sb.append(leaf.toString()); - sep = ", "; + if(!(t instanceof LeafTypeInfo)) + { + return false; + } } - } else - { - sb.append("None"); + + return true; } - - sb.append(".\n"); - sb.append("Allows null: "); - sb.append(allowsNull()); - sb.append(".\n"); - - sb.append("Has invariant: " + hasInv()); - - return sb.toString(); + return false; } @Override public boolean allowsNull() { // This type allows null either if it is - // 1) optional or + // 1) optional or // 2) any child type allows null // // Example. Given: // N = nat; C = [char]; CN = C|N // Then CN allows null. C allows null. N does not allow null. - - if(optional) + + if (optional) { return true; } - else + + if(domainType != null) { - for(LeafTypeInfo leaf : leafTypes) - { - if(leaf.allowsNull()) - { - return true; - } - } - - for(NamedTypeInfo n : namedTypes) - { - if(n.allowsNull()) - { - return true; - } - } + return domainType.allowsNull(); } return false; @@ -267,18 +203,12 @@ public boolean allowsNull() @Override public List getLeafTypesRecursively() { - List allLeaftypes = new LinkedList(); - - for(LeafTypeInfo leaf : leafTypes) - { - allLeaftypes.addAll(leaf.getLeafTypesRecursively()); - } - - for(NamedTypeInfo named : namedTypes) - { - allLeaftypes.addAll(named.getLeafTypesRecursively()); - } - - return allLeaftypes; + return domainType.getLeafTypesRecursively(); + } + + @Override + public String toString() + { + return "(" + this.typeName + " = " + domainType + ")"; } } From d1a9e7c247323f8508a2d5972035c44e06de651d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 13:32:26 +0200 Subject: [PATCH 121/706] Update 'TypeDependencyTests' to work with the new type info structure --- .../vdm2jml/tests/TypeDependencyTests.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java index 908d40256c..9011c193f1 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java @@ -75,12 +75,6 @@ private void assertTypeName(String typeName, NamedTypeInfo info) Assert.assertEquals("Expected type name to be '" + typeName + "'", typeName, info.getTypeName()); } - private void assertNamedChildren(NamedTypeInfo info, int no) - { - Assert.assertTrue("Expected " + no + " named types for type " - + infoStr(info), info.getNamedTypes().size() == no); - } - private String infoStr(NamedTypeInfo info) { String message = info.getDefModule() + "." + info.getTypeName(); @@ -89,13 +83,13 @@ private String infoStr(NamedTypeInfo info) private void assertNoOfLeafs(NamedTypeInfo info, int no) { - Assert.assertEquals("Number of actual leaf types differs from those expected", no, info.getLeafTypes().size()); + Assert.assertEquals("Number of actual leaf types differs from those expected", no, info.getLeafTypesRecursively().size()); } private void assertLeafType(NamedTypeInfo info, Class leafType, boolean nullAllowed) { - for (LeafTypeInfo leaf : info.getLeafTypes()) + for (LeafTypeInfo leaf : info.getLeafTypesRecursively()) { if (leafType == leaf.getType().getClass()) { @@ -156,7 +150,6 @@ public void namedInvTypeNat() NamedTypeInfo info = getInfo(typeName); assertTotalNoOfNamedInvTypes(1); - assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); assertLeafType(info, ANatNumericBasicTypeCG.class, false); assertNullNotAllowed(info); @@ -173,7 +166,6 @@ public void namedInvTypeNatOpt() NamedTypeInfo info = getInfo(typeName); assertTotalNoOfNamedInvTypes(1); - assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); assertLeafType(info, ANatNumericBasicTypeCG.class, true); assertNullAllowed(info); @@ -190,7 +182,6 @@ public void unionOfBasicAndOptBasic() NamedTypeInfo info = getInfo(typeName); assertTotalNoOfNamedInvTypes(1); - assertNamedChildren(info, 0); assertNoOfLeafs(info, 2); assertLeafType(info, ANatNumericBasicTypeCG.class, false); assertLeafType(info, ACharBasicTypeCG.class, true); @@ -211,15 +202,13 @@ public void unionOfNamedInvTypes() NamedTypeInfo info = getInfo(typeName); assertTotalNoOfNamedInvTypes(3); - assertNamedChildren(info, 2); - assertNoOfLeafs(info, 0); + assertNoOfLeafs(info, 2); assertNullAllowed(info); assertNoInv(info); typeName = "N"; info = getInfo(typeName); - assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); assertLeafType(info, ANatNumericBasicTypeCG.class, false); assertNullNotAllowed(info); @@ -228,7 +217,6 @@ public void unionOfNamedInvTypes() typeName = "C"; info = getInfo(typeName); - assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); assertLeafType(info, ACharBasicTypeCG.class, true); assertNullAllowed(info); @@ -277,7 +265,6 @@ public void record() // We do not expect the record to be included assertTotalNoOfNamedInvTypes(1); - assertNamedChildren(info, 0); // We expect to have the record type 'R' registered as a leaf type assertNoOfLeafs(info, 2); } @@ -293,7 +280,6 @@ public void recursive() NamedTypeInfo info = getInfo(typeName); assertTotalNoOfNamedInvTypes(1); - assertNamedChildren(info, 0); assertNoOfLeafs(info, 1); assertLeafType(info, ANatNumericBasicTypeCG.class, false); } From df808e853feac48921b207cefc6f92668bc45fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 13:51:45 +0200 Subject: [PATCH 122/706] Update type dependency calculator to construct type info based on the new structure --- .../info/NamedTypeInvDepCalculator.java | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index 9bde53d72d..22d88e8a0a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -117,15 +117,26 @@ public void caseANamedInvariantType(ANamedInvariantType node) // Avoid unnecessary construction if (!containsExactly(node)) { - typeInfoList.addAll(create(info, node, null, new HashSet())); + AbstractTypeInfo typeInfo = create(info, node, new HashSet()); + + if(typeInfo instanceof NamedTypeInfo) + { + typeInfoList.add((NamedTypeInfo) typeInfo); + } + else + { + Logger.getLog().printErrorln("Expected a '" + NamedTypeInfo.class.getSimpleName() + + "' to be returned. Got: " + typeInfo); + } } } - - private static List create(IRInfo info, PType type, NamedTypeInfo previous, Set visited) + + private static AbstractTypeInfo create(IRInfo info, PType type, Set visited) { if(visited.contains(type)) { - return new LinkedList(); + // Type recursion + return null; } else { @@ -145,41 +156,36 @@ private static List create(IRInfo info, PType type, NamedTypeInfo } } - List data = new LinkedList(); - if (type instanceof ANamedInvariantType) { ANamedInvariantType namedType = (ANamedInvariantType) type; - NamedTypeInfo typeData = new NamedTypeInfo(namedType.getName().getName(), - namedType.getName().getModule(), namedType.getInvDef() != null, optional); - - typeData.getNamedTypes().addAll(create(info, namedType.getType(), typeData, visited)); + AbstractTypeInfo domainInfo = create(info, namedType.getType(), visited); + NamedTypeInfo namedInfo = new NamedTypeInfo(namedType.getName().getName(), + namedType.getName().getModule(), namedType.getInvDef() != null, optional, domainInfo); - data.add(typeData); + return namedInfo; + } else if (type instanceof AUnionType) { - // Say we are visiting a union type that is optional, e.g. - //T = [S | nat]; - // Then we mark the previous type, e.g T as optional - if(optional && previous != null) - { - previous.makeOptional(); - } + UnionInfo unionInfo = new UnionInfo(optional); for (PType t : ((AUnionType) type).getTypes()) { - data.addAll(create(info, t, previous, visited)); + AbstractTypeInfo tInfo = create(info, t, visited); + + if(tInfo != null) + { + unionInfo.getTypes().add(tInfo); + } } + + return unionInfo; + } else { - if (previous != null) - { - previous.getLeafTypes().add(new LeafTypeInfo(toIrType(type, info), optional)); - } + return new LeafTypeInfo(toIrType(type, info), optional); } - - return data; } public static STypeCG toIrType(PType type, IRInfo info) From 232dd1d05ca1d9b7175b2c6bdfc90e8338ea0bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 17:35:43 +0200 Subject: [PATCH 123/706] Update named type info to also take leaf types into account during predicate construction --- .../predgen/info/AbstractTypeInfo.java | 10 +-- .../vdm2jml/predgen/info/LeafTypeInfo.java | 7 +- .../vdm2jml/predgen/info/NamedTypeInfo.java | 79 +++++++++---------- .../vdm2jml/predgen/info/UnionInfo.java | 39 ++++----- 4 files changed, 60 insertions(+), 75 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java index 3e2774b686..547e42fe94 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java @@ -13,11 +13,6 @@ public AbstractTypeInfo(boolean optional) this.optional = optional; } - public void makeOptional() - { - this.optional = true; - } - abstract public boolean allowsNull(); abstract public List getLeafTypesRecursively(); @@ -25,4 +20,9 @@ public void makeOptional() abstract public boolean contains(AbstractTypeInfo subject); abstract public String consCheckExp(String enclosingClass, String javaRootPackage); + + public String consIsNullCheck() + { + return "(" + ARG_PLACEHOLDER + " == null)"; + } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java index 4ee8c0e6c9..afe29acf82 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java @@ -20,6 +20,7 @@ import org.overture.codegen.runtime.Utils; import org.overture.codegen.vdm2java.JavaQuoteValueCreator; import org.overture.codegen.vdm2jml.JmlGenUtil; +import org.overture.codegen.vdm2jml.JmlGenerator; public class LeafTypeInfo extends AbstractTypeInfo { @@ -129,7 +130,7 @@ public String consCheckExp(String enclosingClass, String javaRootPackage) if(methodName == null) { Logger.getLog().printErrorln("Got unhandled case"); - return null; + return "true"; } String call; @@ -155,9 +156,9 @@ else if(type instanceof ARecordTypeCG) } // If the type is optional 'null' is also a legal value - if(optional) + if(allowsNull()) { - return "(" + ARG_PLACEHOLDER + " == null || " + call + ")"; + return "(" + consIsNullCheck() + JmlGenerator.JML_OR + call + ")"; } return call; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java index e5878f9970..c28b290f57 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java @@ -1,6 +1,6 @@ package org.overture.codegen.vdm2jml.predgen.info; -import java.util.LinkedList; + import java.util.List; import org.overture.codegen.vdm2jml.JmlGenerator; @@ -115,12 +115,6 @@ public static boolean isSameTypeDef(NamedTypeInfo typeData, public String consCheckExp(String enclosingModule, String javaRootPackages) { StringBuilder sb = new StringBuilder(); - consCheckExp(sb, enclosingModule, javaRootPackages); - return sb.toString(); - } - - private void consCheckExp(StringBuilder sb, String enclosingModule, String javaRootPackage) - { // // If the type is not defined in the enclosing class we use the absolute name // // to refer to the invariant method // if(!defModule.equals(enclosingModule)) @@ -130,6 +124,18 @@ private void consCheckExp(StringBuilder sb, String enclosingModule, String javaR // sb.append(defModule); // sb.append("."); // } + + if (allowsNull()) + { + sb.append(consIsNullCheck()); + sb.append(JmlGenerator.JML_OR); + } + + if (domainType != null) + { + sb.append(domainType.consCheckExp(enclosingModule, javaRootPackages)); + sb.append(JmlGenerator.JML_AND); + } sb.append(JmlGenerator.INV_PREFIX); sb.append(defModule); @@ -140,42 +146,9 @@ private void consCheckExp(StringBuilder sb, String enclosingModule, String javaR sb.append(ARG_PLACEHOLDER); sb.append(')'); - if (domainType != null) - { - //TODO: remvoe eventually - if(!onlyBasics()) - { - sb.append(JmlGenerator.JML_AND); - sb.append(domainType.consCheckExp(enclosingModule, javaRootPackage)); - - } - } + return "(" + sb.toString() + ")"; } - - //TODO: REMOVE THIS - private boolean onlyBasics() - { - if(domainType instanceof LeafTypeInfo) - { - return true; - } - - if(domainType instanceof UnionInfo) - { - for(AbstractTypeInfo t : ((UnionInfo) domainType).getTypes()) - { - if(!(t instanceof LeafTypeInfo)) - { - return false; - } - } - - return true; - } - - return false; - } - + @Override public boolean allowsNull() { @@ -209,6 +182,26 @@ public List getLeafTypesRecursively() @Override public String toString() { - return "(" + this.typeName + " = " + domainType + ")"; + StringBuilder sb = new StringBuilder(); + + sb.append('('); + + if(optional) + { + sb.append("["); + } + + sb.append(this.typeName); + sb.append(" = "); + sb.append(domainType); + + if(optional) + { + sb.append("]"); + } + + sb.append(')'); + + return sb.toString(); } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java index f4197f6ca5..0d9df5da0d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java @@ -59,44 +59,24 @@ public boolean contains(AbstractTypeInfo subject) return false; } - //TODO: eventually this must go out - private List removeDirectLeaves() - { - List filtered = new LinkedList<>(); - - for(AbstractTypeInfo t : types) - { - if(!(t instanceof LeafTypeInfo)) - { - filtered.add(t); - } - } - - return filtered; - } - @Override public String consCheckExp(String enclosingModule, String javaRootPackage) { - //TODO: remove eventually - List types = removeDirectLeaves(); - StringBuilder sb = new StringBuilder(); sb.append('('); String orSep = ""; - boolean allowsNull = allowsNull(); - if(allowsNull) + if(allowsNull()) { - sb.append(ARG_PLACEHOLDER + " == null"); + sb.append(consIsNullCheck()); orSep = JmlGenerator.JML_OR; } - for (AbstractTypeInfo n : types) + for (AbstractTypeInfo currentType : types) { sb.append(orSep); - sb.append(n.consCheckExp(enclosingModule, javaRootPackage)); + sb.append(currentType.consCheckExp(enclosingModule, javaRootPackage)); orSep = JmlGenerator.JML_OR; } @@ -111,6 +91,11 @@ public String toString() StringBuilder sb = new StringBuilder(); sb.append('('); + if(optional) + { + sb.append("["); + } + String sep = ""; for(AbstractTypeInfo t : types) { @@ -119,7 +104,13 @@ public String toString() sep = "|"; } + if(optional) + { + sb.append("]"); + } + sb.append(')'); + return sb.toString(); } } From 508e89fe992a79c1d8bb6e182f201a73643e1266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 17:36:35 +0200 Subject: [PATCH 124/706] Add one more type dependency test --- .../overture/vdm2jml/tests/TypeDependencyTests.java | 13 +++++++++++++ .../test/resources/type_dep/OptionalNamedType.vdmsl | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/type_dep/OptionalNamedType.vdmsl diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java index 9011c193f1..2a0c2d7997 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/TypeDependencyTests.java @@ -250,6 +250,19 @@ public void optionalUnion() assertNullNotAllowed(getInfo("N")); assertNullNotAllowed(getInfo("C")); } + + @Test + public void optionalNamed() + { + load("OptionalNamedType.vdmsl"); + //CN = [C]|N; + //N = nat; + //C = char; + + assertNullAllowed(getInfo("CN")); + assertNullNotAllowed(getInfo("C")); + assertNullNotAllowed(getInfo("N")); + } @Test public void record() diff --git a/core/codegen/vdm2jml/src/test/resources/type_dep/OptionalNamedType.vdmsl b/core/codegen/vdm2jml/src/test/resources/type_dep/OptionalNamedType.vdmsl new file mode 100644 index 0000000000..efdeac7132 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/type_dep/OptionalNamedType.vdmsl @@ -0,0 +1,11 @@ +module Entry + +exports all +definitions + +types +CN = [C]|N; +N = nat; +C = char; + +end Entry \ No newline at end of file From 669bb9b3b233cac23003bc2375378f17ca9d198a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 18:25:29 +0200 Subject: [PATCH 125/706] Expect named type info predicate to include basic type assertions --- .../basictype/BoolReturnNil/Entry.java | 2 +- .../basictype/CharReturnNil/Entry.java | 4 ++-- .../basictype/NatParamNil/Entry.java | 8 +++---- .../basictype/QuoteAssignNil/Entry.java | 4 ++-- .../basictype/RatAssignBool/Entry.java | 2 +- .../basictype/RealParamNil/Entry.java | 4 ++-- .../basictype/TokenAssignNil/Entry.java | 4 ++-- .../MaskedRecInvViolated/Entry.java | 8 +++---- .../MaskedRecInvViolated/R2.java | 10 ++++----- .../MaskedRecNamedTypeInv/Entry.java | 6 ++--- .../MaskedRecNamedTypeInv/R2.java | 10 ++++----- .../NamedTypeInvUnionTypeRec/Entry.java | 8 +++---- .../NamedTypeInvUnionTypeRec/R2.java | 10 ++++----- .../NamedTypeInvAsssignments/Entry.java | 10 ++++----- .../NamedTypeInvAsssignments/St.java | 10 ++++----- .../NamedTypeInvLocalDecls/Entry.java | 4 ++-- .../NamedTypeInvMapUpdate/Entry.java | 8 +++---- .../NamedTypeInvMethodParam/Entry.java | 10 ++++----- .../NamedTypeInvNullAllowed/Entry.java | 2 +- .../NamedTypeInvReturn/Entry.java | 22 +++++++++---------- .../NamedTypeInvSeqUpdate/Entry.java | 8 +++---- .../NamedTypeInvValues/Entry.java | 4 ++-- .../AssignBoolTypeViolation/Entry.java | 6 ++--- .../FuncReturnTokenViolation/Entry.java | 4 ++-- .../OpParamQuoteTypeViolation/Entry.java | 2 +- .../VarDeclTypeViolation/Entry.java | 4 ++-- 26 files changed, 87 insertions(+), 87 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java index 0ddcd0c350..cc68aba3db 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java @@ -39,7 +39,7 @@ public static Boolean boolTrue() { public static Boolean boolNil() { Boolean ret_2 = null; - //@ assert (ret_2 == null || Utils.is_bool(ret_2)); + //@ assert ((ret_2 == null) || Utils.is_bool(ret_2)); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java index 378785eade..ae1763c4b5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java @@ -43,7 +43,7 @@ public static Object Run() { public static Character charA() { Character ret_1 = 'a'; - //@ assert (ret_1 == null || Utils.is_char(ret_1)); + //@ assert ((ret_1 == null) || Utils.is_char(ret_1)); return ret_1; } @@ -51,7 +51,7 @@ public static Character charA() { public static Character charNil() { Character ret_2 = null; - //@ assert (ret_2 == null || Utils.is_char(ret_2)); + //@ assert ((ret_2 == null) || Utils.is_char(ret_2)); return ret_2; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java index 1dc36f951c..7118a9285a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java @@ -14,16 +14,16 @@ private Entry() { public static Object Run() { Number n = 0L; - //@ assert (n == null || Utils.is_nat(n)); + //@ assert ((n == null) || Utils.is_nat(n)); IO.println("Before valid use."); n = 1L; - //@ assert (n == null || Utils.is_nat(n)); + //@ assert ((n == null) || Utils.is_nat(n)); n = null; - //@ assert (n == null || Utils.is_nat(n)); + //@ assert ((n == null) || Utils.is_nat(n)); IO.println("After valid use."); IO.println("Before invalid use."); n = idNat(n); - //@ assert (n == null || Utils.is_nat(n)); + //@ assert ((n == null) || Utils.is_nat(n)); IO.println("After invalid use."); return 0L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java index 43ab29fab1..cd5a40a397 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { project.quotes.AQuote aOpt = null; - //@ assert (aOpt == null || Utils.is_(aOpt,project.quotes.AQuote.class)); + //@ assert ((aOpt == null) || Utils.is_(aOpt,project.quotes.AQuote.class)); /* skip */ } @@ -43,7 +43,7 @@ public static Object Run() { public static project.quotes.AQuote Nil() { project.quotes.AQuote ret_1 = null; - //@ assert (ret_1 == null || Utils.is_(ret_1,project.quotes.AQuote.class)); + //@ assert ((ret_1 == null) || Utils.is_(ret_1,project.quotes.AQuote.class)); return ret_1; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java index 28e431711d..93cba92d88 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java @@ -31,7 +31,7 @@ public static Object Run() { public static Number ratOpt() { Number ret_1 = null; - //@ assert (ret_1 == null || Utils.is_rat(ret_1)); + //@ assert ((ret_1 == null) || Utils.is_rat(ret_1)); return ret_1; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java index fb6cccfa48..ca549e9010 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java @@ -14,11 +14,11 @@ private Entry() { public static Object Run() { Number r = 1.23; - //@ assert (r == null || Utils.is_real(r)); + //@ assert ((r == null) || Utils.is_real(r)); IO.println("Before valid use."); doSkip(r); r = null; - //@ assert (r == null || Utils.is_real(r)); + //@ assert ((r == null) || Utils.is_real(r)); IO.println("After valid use."); IO.println("Before invalid use."); doSkip(r); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java index d2e589d15a..892b3d087b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java @@ -8,10 +8,10 @@ //@ nullable_by_default @SuppressWarnings("all") final public class Entry { - //@ public static invariant (n == null || Utils.is_token(n)); + //@ public static invariant ((n == null) || Utils.is_token(n)); public static final Token n = null; - //@ public static invariant (t == null || Utils.is_token(t)); + //@ public static invariant ((t == null) || Utils.is_token(t)); public static final Token t = new Token(""); /*@ public ghost static boolean invChecksOn = true; @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java index 8c017834aa..87c84a24c6 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java @@ -86,7 +86,7 @@ public static Number useOk() { //@ assert stateDes_3.valid(); - //@ assert inv_Entry_T3(stateDes_2); + //@ assert (Utils.is_(stateDes_2,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_2)); //@ assert stateDes_2.valid(); @@ -100,7 +100,7 @@ public static Number useOk() { //@ assert stateDes_6.valid(); - //@ assert inv_Entry_T3(stateDes_5); + //@ assert (Utils.is_(stateDes_5,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_5)); //@ assert stateDes_5.valid(); @@ -110,7 +110,7 @@ public static Number useOk() { //@ assert stateDes_9.valid(); - //@ assert inv_Entry_T3(stateDes_8); + //@ assert (Utils.is_(stateDes_8,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_8)); //@ assert stateDes_8.valid(); @@ -147,7 +147,7 @@ public static Number useNotOk() { //@ assert stateDes_12.valid(); - //@ assert inv_Entry_T3(stateDes_11); + //@ assert (Utils.is_(stateDes_11,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_11)); //@ assert stateDes_11.valid(); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java index e55464a454..58863a8ca4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java @@ -12,10 +12,10 @@ final public class R2 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R2(t3); public R2(final project.Entrytypes.R3 _t3) { - //@ assert inv_Entry_T3(_t3); + //@ assert (Utils.is_(_t3,project.Entrytypes.R3.class) && inv_Entry_T3(_t3)); t3 = (_t3 != null) ? Utils.copy(_t3) : null; - //@ assert inv_Entry_T3(t3); + //@ assert (Utils.is_(t3,project.Entrytypes.R3.class) && inv_Entry_T3(t3)); } /*@ pure @*/ @@ -48,15 +48,15 @@ public String toString() { public project.Entrytypes.R3 get_t3() { project.Entrytypes.R3 ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); + //@ assert project.Entry.invChecksOn ==> ((Utils.is_(ret_4,project.Entrytypes.R3.class) && inv_Entry_T3(ret_4))); return ret_4; } public void set_t3(final project.Entrytypes.R3 _t3) { - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(_t3)); + //@ assert project.Entry.invChecksOn ==> ((Utils.is_(_t3,project.Entrytypes.R3.class) && inv_Entry_T3(_t3))); t3 = _t3; - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(t3)); + //@ assert project.Entry.invChecksOn ==> ((Utils.is_(t3,project.Entrytypes.R3.class) && inv_Entry_T3(t3))); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java index f27e5b7557..0f24259a88 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java @@ -74,7 +74,7 @@ public static Number useOk() { //@ assert stateDes_3.valid(); - //@ assert inv_Entry_T3(stateDes_2); + //@ assert (Utils.is_(stateDes_2,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_2)); //@ assert stateDes_2.valid(); @@ -88,7 +88,7 @@ public static Number useOk() { //@ assert stateDes_6.valid(); - //@ assert inv_Entry_T3(stateDes_5); + //@ assert (Utils.is_(stateDes_5,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_5)); //@ assert stateDes_5.valid(); @@ -125,7 +125,7 @@ public static Number useNotOk() { //@ assert stateDes_9.valid(); - //@ assert inv_Entry_T3(stateDes_8); + //@ assert (Utils.is_(stateDes_8,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_8)); //@ assert stateDes_8.valid(); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java index e55464a454..58863a8ca4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java @@ -12,10 +12,10 @@ final public class R2 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R2(t3); public R2(final project.Entrytypes.R3 _t3) { - //@ assert inv_Entry_T3(_t3); + //@ assert (Utils.is_(_t3,project.Entrytypes.R3.class) && inv_Entry_T3(_t3)); t3 = (_t3 != null) ? Utils.copy(_t3) : null; - //@ assert inv_Entry_T3(t3); + //@ assert (Utils.is_(t3,project.Entrytypes.R3.class) && inv_Entry_T3(t3)); } /*@ pure @*/ @@ -48,15 +48,15 @@ public String toString() { public project.Entrytypes.R3 get_t3() { project.Entrytypes.R3 ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); + //@ assert project.Entry.invChecksOn ==> ((Utils.is_(ret_4,project.Entrytypes.R3.class) && inv_Entry_T3(ret_4))); return ret_4; } public void set_t3(final project.Entrytypes.R3 _t3) { - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(_t3)); + //@ assert project.Entry.invChecksOn ==> ((Utils.is_(_t3,project.Entrytypes.R3.class) && inv_Entry_T3(_t3))); t3 = _t3; - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(t3)); + //@ assert project.Entry.invChecksOn ==> ((Utils.is_(t3,project.Entrytypes.R3.class) && inv_Entry_T3(t3))); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index 39dc48fb39..8dcdfa7579 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -107,7 +107,7 @@ public static Number useOk() { //@ assert stateDes_3.valid(); - //@ assert inv_Entry_T3(stateDes_2); + //@ assert ((Utils.is_(stateDes_2,project.Entrytypes.R3.class) || Utils.is_(stateDes_2,project.Entrytypes.X.class)) && inv_Entry_T3(stateDes_2)); //@ assert stateDes_2 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_2).valid(); @@ -123,7 +123,7 @@ public static Number useOk() { //@ assert stateDes_6.valid(); - //@ assert inv_Entry_T3(stateDes_5); + //@ assert ((Utils.is_(stateDes_5,project.Entrytypes.R3.class) || Utils.is_(stateDes_5,project.Entrytypes.X.class)) && inv_Entry_T3(stateDes_5)); //@ assert stateDes_5 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_5).valid(); @@ -135,7 +135,7 @@ public static Number useOk() { //@ assert stateDes_9.valid(); - //@ assert inv_Entry_T3(stateDes_8); + //@ assert ((Utils.is_(stateDes_8,project.Entrytypes.R3.class) || Utils.is_(stateDes_8,project.Entrytypes.X.class)) && inv_Entry_T3(stateDes_8)); //@ assert stateDes_8 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_8).valid(); @@ -181,7 +181,7 @@ public static Number useNotOk() { //@ assert stateDes_12.valid(); - //@ assert inv_Entry_T3(stateDes_11); + //@ assert ((Utils.is_(stateDes_11,project.Entrytypes.R3.class) || Utils.is_(stateDes_11,project.Entrytypes.X.class)) && inv_Entry_T3(stateDes_11)); //@ assert stateDes_11 instanceof project.Entrytypes.X ==> ((project.Entrytypes.X) stateDes_11).valid(); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java index ac06ab73a7..3c590b57c7 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java @@ -12,10 +12,10 @@ final public class R2 implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_R2(t3); public R2(final Object _t3) { - //@ assert inv_Entry_T3(_t3); + //@ assert ((Utils.is_(_t3,project.Entrytypes.R3.class) || Utils.is_(_t3,project.Entrytypes.X.class)) && inv_Entry_T3(_t3)); t3 = (_t3 != null) ? _t3 : null; - //@ assert inv_Entry_T3(t3); + //@ assert ((Utils.is_(t3,project.Entrytypes.R3.class) || Utils.is_(t3,project.Entrytypes.X.class)) && inv_Entry_T3(t3)); } /*@ pure @*/ @@ -48,15 +48,15 @@ public String toString() { public Object get_t3() { Object ret_4 = t3; - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(ret_4)); + //@ assert project.Entry.invChecksOn ==> (((Utils.is_(ret_4,project.Entrytypes.R3.class) || Utils.is_(ret_4,project.Entrytypes.X.class)) && inv_Entry_T3(ret_4))); return ret_4; } public void set_t3(final Object _t3) { - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(_t3)); + //@ assert project.Entry.invChecksOn ==> (((Utils.is_(_t3,project.Entrytypes.R3.class) || Utils.is_(_t3,project.Entrytypes.X.class)) && inv_Entry_T3(_t3))); t3 = _t3; - //@ assert project.Entry.invChecksOn ==> (inv_Entry_T3(t3)); + //@ assert project.Entry.invChecksOn ==> (((Utils.is_(t3,project.Entrytypes.R3.class) || Utils.is_(t3,project.Entrytypes.X.class)) && inv_Entry_T3(t3))); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java index 3d9237a9ea..3a38972b03 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java @@ -17,11 +17,11 @@ private Entry() { public static void op1() { Object p = null; - //@ assert inv_Entry_PT(p) && (p == null || inv_Entry_PossiblyOne(p) || inv_Entry_True(p)); + //@ assert ((p == null) || ((p == null) || ((p == null) || ((p == null) || Utils.is_nat(p)) && inv_Entry_PossiblyOne(p)) || (Utils.is_bool(p) && inv_Entry_True(p))) && inv_Entry_PT(p)); p = 1L; - //@ assert inv_Entry_PT(p) && (p == null || inv_Entry_PossiblyOne(p) || inv_Entry_True(p)); + //@ assert ((p == null) || ((p == null) || ((p == null) || ((p == null) || Utils.is_nat(p)) && inv_Entry_PossiblyOne(p)) || (Utils.is_bool(p) && inv_Entry_True(p))) && inv_Entry_PT(p)); p = true; - //@ assert inv_Entry_PT(p) && (p == null || inv_Entry_PossiblyOne(p) || inv_Entry_True(p)); + //@ assert ((p == null) || ((p == null) || ((p == null) || ((p == null) || Utils.is_nat(p)) && inv_Entry_PossiblyOne(p)) || (Utils.is_bool(p) && inv_Entry_True(p))) && inv_Entry_PT(p)); //@ assert St != null; St.set_x(null); @@ -39,7 +39,7 @@ public static void op1() { public static void op2() { Object p1 = null; - //@ assert inv_Entry_PT(p1) && (p1 == null || inv_Entry_PossiblyOne(p1) || inv_Entry_True(p1)); + //@ assert ((p1 == null) || ((p1 == null) || ((p1 == null) || ((p1 == null) || Utils.is_nat(p1)) && inv_Entry_PossiblyOne(p1)) || (Utils.is_bool(p1) && inv_Entry_True(p1))) && inv_Entry_PT(p1)); //@ assert St != null; St.set_x(true); @@ -47,7 +47,7 @@ public static void op2() { IO.println("Breaking named type invariant (assigning local variable)"); p1 = false; - //@ assert inv_Entry_PT(p1) && (p1 == null || inv_Entry_PossiblyOne(p1) || inv_Entry_True(p1)); + //@ assert ((p1 == null) || ((p1 == null) || ((p1 == null) || ((p1 == null) || Utils.is_nat(p1)) && inv_Entry_PossiblyOne(p1)) || (Utils.is_bool(p1) && inv_Entry_True(p1))) && inv_Entry_PT(p1)); } public static Object Run() { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java index 82684cf233..d14d55f2fd 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java @@ -11,10 +11,10 @@ final public class St implements Record { public Object x; public St(final Object _x) { - //@ assert inv_Entry_PT(_x) && (_x == null || inv_Entry_PossiblyOne(_x) || inv_Entry_True(_x)); + //@ assert ((_x == null) || ((_x == null) || ((_x == null) || ((_x == null) || Utils.is_nat(_x)) && inv_Entry_PossiblyOne(_x)) || (Utils.is_bool(_x) && inv_Entry_True(_x))) && inv_Entry_PT(_x)); x = (_x != null) ? _x : null; - //@ assert inv_Entry_PT(x) && (x == null || inv_Entry_PossiblyOne(x) || inv_Entry_True(x)); + //@ assert ((x == null) || ((x == null) || ((x == null) || ((x == null) || Utils.is_nat(x)) && inv_Entry_PossiblyOne(x)) || (Utils.is_bool(x) && inv_Entry_True(x))) && inv_Entry_PT(x)); } /*@ pure @*/ @@ -47,15 +47,15 @@ public String toString() { public Object get_x() { Object ret_1 = x; - //@ assert project.Entry.invChecksOn ==> (inv_Entry_PT(ret_1) && (ret_1 == null || inv_Entry_PossiblyOne(ret_1) || inv_Entry_True(ret_1))); + //@ assert project.Entry.invChecksOn ==> (((ret_1 == null) || ((ret_1 == null) || ((ret_1 == null) || ((ret_1 == null) || Utils.is_nat(ret_1)) && inv_Entry_PossiblyOne(ret_1)) || (Utils.is_bool(ret_1) && inv_Entry_True(ret_1))) && inv_Entry_PT(ret_1))); return ret_1; } public void set_x(final Object _x) { - //@ assert project.Entry.invChecksOn ==> (inv_Entry_PT(_x) && (_x == null || inv_Entry_PossiblyOne(_x) || inv_Entry_True(_x))); + //@ assert project.Entry.invChecksOn ==> (((_x == null) || ((_x == null) || ((_x == null) || ((_x == null) || Utils.is_nat(_x)) && inv_Entry_PossiblyOne(_x)) || (Utils.is_bool(_x) && inv_Entry_True(_x))) && inv_Entry_PT(_x))); x = _x; - //@ assert project.Entry.invChecksOn ==> (inv_Entry_PT(x) && (x == null || inv_Entry_PossiblyOne(x) || inv_Entry_True(x))); + //@ assert project.Entry.invChecksOn ==> (((x == null) || ((x == null) || ((x == null) || ((x == null) || Utils.is_nat(x)) && inv_Entry_PossiblyOne(x)) || (Utils.is_bool(x) && inv_Entry_True(x))) && inv_Entry_PT(x))); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java index 5b6a6f054e..887ef62cb9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java @@ -18,7 +18,7 @@ public static void typeUseOk() { //@ assert Utils.is_nat1(ignorePattern_1); Object even = 2L; - //@ assert inv_Entry_No(even) && (inv_Entry_Even(even) || inv_Entry_Large(even)); + //@ assert (((Utils.is_nat(even) && inv_Entry_Even(even)) || (Utils.is_real(even) && inv_Entry_Large(even))) && inv_Entry_No(even)); Number ignorePattern_2 = 3L; //@ assert Utils.is_nat1(ignorePattern_2); @@ -31,7 +31,7 @@ public static void typeUseNotOk() { { Object notLarge = 999L; - //@ assert inv_Entry_No(notLarge) && (inv_Entry_Even(notLarge) || inv_Entry_Large(notLarge)); + //@ assert (((Utils.is_nat(notLarge) && inv_Entry_Even(notLarge)) || (Utils.is_real(notLarge) && inv_Entry_Large(notLarge))) && inv_Entry_No(notLarge)); IO.println("After breaking named type invariant"); /* skip */ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java index 671761f789..10fe8df8db 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java @@ -14,20 +14,20 @@ private Entry() { public static Object Run() { VDMMap m = MapUtil.map(new Maplet('a', 1L), new Maplet(1L, 2L)); - //@ assert inv_Entry_M(m); + //@ assert (true && inv_Entry_M(m)); //@ assert m != null; Utils.mapSeqUpdate(m, 'a', 2L); - //@ assert inv_Entry_M(m); + //@ assert (true && inv_Entry_M(m)); //@ assert m != null; Utils.mapSeqUpdate(m, 1L, 2L); - //@ assert inv_Entry_M(m); + //@ assert (true && inv_Entry_M(m)); IO.println("Breaking named type invariant for sequence"); //@ assert m != null; Utils.mapSeqUpdate(m, 2L, 10L); - //@ assert inv_Entry_M(m); + //@ assert (true && inv_Entry_M(m)); return 0L; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java index 19d487884b..eaee40b3f5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java @@ -22,7 +22,7 @@ public static Object Run() { { Number ignorePattern_1 = op(n1, 5L, n1); - //@ assert inv_Entry_Even(ignorePattern_1); + //@ assert (Utils.is_nat(ignorePattern_1) && inv_Entry_Even(ignorePattern_1)); /* skip */ } @@ -32,7 +32,7 @@ public static Object Run() { { Number ignorePattern_2 = op(n1, 6L, n2); - //@ assert inv_Entry_Even(ignorePattern_2); + //@ assert (Utils.is_nat(ignorePattern_2) && inv_Entry_Even(ignorePattern_2)); /* skip */ } @@ -42,14 +42,14 @@ public static Object Run() { } public static Number op(final Number a, final Number b, final Number c) { - //@ assert inv_Entry_Even(a); + //@ assert (Utils.is_nat(a) && inv_Entry_Even(a)); //@ assert Utils.is_nat(b); - //@ assert inv_Entry_Even(c); + //@ assert (Utils.is_nat(c) && inv_Entry_Even(c)); Number ret_1 = b.longValue() * (a.longValue() + c.longValue()); - //@ assert inv_Entry_Even(ret_1); + //@ assert (Utils.is_nat(ret_1) && inv_Entry_Even(ret_1)); return ret_1; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java index d4fcd055c0..c6186b2cc0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java @@ -15,7 +15,7 @@ private Entry() { public static Object Run() { Object e = null; - //@ assert inv_Entry_N(e) && (e == null || inv_Entry_X(e) || inv_Entry_Y(e)); + //@ assert ((e == null) || ((e == null) || (Utils.is_nat(e) && inv_Entry_X(e)) || (Utils.is_char(e) && inv_Entry_Y(e))) && inv_Entry_N(e)); return e; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java index 0c8491b4a9..7a25ee5a9d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java @@ -15,25 +15,25 @@ private Entry() { public static Object Run() { Character ignorePattern_1 = idC('b'); - //@ assert inv_Entry_C(ignorePattern_1); + //@ assert (Utils.is_char(ignorePattern_1) && inv_Entry_C(ignorePattern_1)); Character ignorePattern_2 = idC('a'); - //@ assert inv_Entry_C(ignorePattern_2); + //@ assert (Utils.is_char(ignorePattern_2) && inv_Entry_C(ignorePattern_2)); Object ignorePattern_3 = idA(null); - //@ assert inv_Entry_A(ignorePattern_3) && (ignorePattern_3 == null || inv_Entry_B(ignorePattern_3) || inv_Entry_C(ignorePattern_3)); + //@ assert ((ignorePattern_3 == null) || ((ignorePattern_3 == null) || (Utils.is_real(ignorePattern_3) && inv_Entry_B(ignorePattern_3)) || (Utils.is_char(ignorePattern_3) && inv_Entry_C(ignorePattern_3))) && inv_Entry_A(ignorePattern_3)); Object ignorePattern_4 = idA(2.1); - //@ assert inv_Entry_A(ignorePattern_4) && (ignorePattern_4 == null || inv_Entry_B(ignorePattern_4) || inv_Entry_C(ignorePattern_4)); + //@ assert ((ignorePattern_4 == null) || ((ignorePattern_4 == null) || (Utils.is_real(ignorePattern_4) && inv_Entry_B(ignorePattern_4)) || (Utils.is_char(ignorePattern_4) && inv_Entry_C(ignorePattern_4))) && inv_Entry_A(ignorePattern_4)); Object ignorePattern_5 = constFunc(); - //@ assert inv_Entry_A(ignorePattern_5) && (ignorePattern_5 == null || inv_Entry_B(ignorePattern_5) || inv_Entry_C(ignorePattern_5)); + //@ assert ((ignorePattern_5 == null) || ((ignorePattern_5 == null) || (Utils.is_real(ignorePattern_5) && inv_Entry_B(ignorePattern_5)) || (Utils.is_char(ignorePattern_5) && inv_Entry_C(ignorePattern_5))) && inv_Entry_A(ignorePattern_5)); { IO.println("Breaking named type invariant for return value"); { Object ignorePattern_6 = idA('b'); - //@ assert inv_Entry_A(ignorePattern_6) && (ignorePattern_6 == null || inv_Entry_B(ignorePattern_6) || inv_Entry_C(ignorePattern_6)); + //@ assert ((ignorePattern_6 == null) || ((ignorePattern_6 == null) || (Utils.is_real(ignorePattern_6) && inv_Entry_B(ignorePattern_6)) || (Utils.is_char(ignorePattern_6) && inv_Entry_C(ignorePattern_6))) && inv_Entry_A(ignorePattern_6)); /* skip */ } @@ -44,19 +44,19 @@ public static Object Run() { /*@ pure @*/ public static Character idC(final Character c) { - //@ assert inv_Entry_C(c); + //@ assert (Utils.is_char(c) && inv_Entry_C(c)); Character ret_1 = c; - //@ assert inv_Entry_C(ret_1); + //@ assert (Utils.is_char(ret_1) && inv_Entry_C(ret_1)); return ret_1; } /*@ pure @*/ public static Object idA(final Object a) { - //@ assert inv_Entry_A(a) && (a == null || inv_Entry_B(a) || inv_Entry_C(a)); + //@ assert ((a == null) || ((a == null) || (Utils.is_real(a) && inv_Entry_B(a)) || (Utils.is_char(a) && inv_Entry_C(a))) && inv_Entry_A(a)); Object ret_2 = a; - //@ assert inv_Entry_A(ret_2) && (ret_2 == null || inv_Entry_B(ret_2) || inv_Entry_C(ret_2)); + //@ assert ((ret_2 == null) || ((ret_2 == null) || (Utils.is_real(ret_2) && inv_Entry_B(ret_2)) || (Utils.is_char(ret_2) && inv_Entry_C(ret_2))) && inv_Entry_A(ret_2)); return ret_2; } @@ -64,7 +64,7 @@ public static Object idA(final Object a) { public static Object constFunc() { Object ret_3 = 'a'; - //@ assert inv_Entry_A(ret_3) && (ret_3 == null || inv_Entry_B(ret_3) || inv_Entry_C(ret_3)); + //@ assert ((ret_3 == null) || ((ret_3 == null) || (Utils.is_real(ret_3) && inv_Entry_B(ret_3)) || (Utils.is_char(ret_3) && inv_Entry_C(ret_3))) && inv_Entry_A(ret_3)); return ret_3; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java index c83a686fef..0dc42920e5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java @@ -14,20 +14,20 @@ private Entry() { public static Object Run() { VDMSeq s = SeqUtil.seq(10L, 11L, 12L); - //@ assert inv_Entry_S(s); + //@ assert (true && inv_Entry_S(s)); //@ assert s != null; Utils.mapSeqUpdate(s, 1L, 'a'); - //@ assert inv_Entry_S(s); + //@ assert (true && inv_Entry_S(s)); //@ assert s != null; Utils.mapSeqUpdate(s, 2L, null); - //@ assert inv_Entry_S(s); + //@ assert (true && inv_Entry_S(s)); IO.println("Breaking named type invariant for sequence"); //@ assert s != null; Utils.mapSeqUpdate(s, 3L, 4L); - //@ assert inv_Entry_S(s); + //@ assert (true && inv_Entry_S(s)); return 0L; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java index 7ee4e70c8d..2a08cfa583 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java @@ -8,10 +8,10 @@ //@ nullable_by_default @SuppressWarnings("all") final public class Entry { - //@ public static invariant inv_Entry_CN(fOk) && (inv_Entry_C(fOk) || inv_Entry_N(fOk)); + //@ public static invariant (((Utils.is_char(fOk) && inv_Entry_C(fOk)) || (Utils.is_nat(fOk) && inv_Entry_N(fOk))) && inv_Entry_CN(fOk)); public static final Object fOk = 'a'; - //@ public static invariant inv_Entry_CN(fBreak) && (inv_Entry_C(fBreak) || inv_Entry_N(fBreak)); + //@ public static invariant (((Utils.is_char(fBreak) && inv_Entry_C(fBreak)) || (Utils.is_nat(fBreak) && inv_Entry_N(fBreak))) && inv_Entry_CN(fBreak)); public static final Object fBreak = 'b'; /*@ public ghost static boolean invChecksOn = true; @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java index 0d1a5d0c2c..f9986fd44a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java @@ -17,14 +17,14 @@ public static Object Run() { //@ assert Utils.is_bool(b); Boolean bOpt = null; - //@ assert (bOpt == null || Utils.is_bool(bOpt)); + //@ assert ((bOpt == null) || Utils.is_bool(bOpt)); IO.println("Before doing valid assignments"); bOpt = true; - //@ assert (bOpt == null || Utils.is_bool(bOpt)); + //@ assert ((bOpt == null) || Utils.is_bool(bOpt)); b = bOpt; //@ assert Utils.is_bool(b); bOpt = null; - //@ assert (bOpt == null || Utils.is_bool(bOpt)); + //@ assert ((bOpt == null) || Utils.is_bool(bOpt)); IO.println("After doing valid assignments"); IO.println("Before doing illegal assignments"); b = bOpt; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java index d137001d93..59fae0a6e0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java @@ -43,7 +43,7 @@ public static Object Run() { public static Token ok() { Token aOpt = new Token(""); - //@ assert (aOpt == null || Utils.is_token(aOpt)); + //@ assert ((aOpt == null) || Utils.is_token(aOpt)); Token ret_1 = aOpt; //@ assert Utils.is_token(ret_1); @@ -54,7 +54,7 @@ public static Token ok() { public static Token err() { Token aOpt = null; - //@ assert (aOpt == null || Utils.is_token(aOpt)); + //@ assert ((aOpt == null) || Utils.is_token(aOpt)); Token ret_2 = aOpt; //@ assert Utils.is_token(ret_2); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java index 1c004061f0..ef1fd69463 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java @@ -15,7 +15,7 @@ private Entry() { public static Object Run() { project.quotes.AQuote aOpt = null; - //@ assert (aOpt == null || Utils.is_(aOpt,project.quotes.AQuote.class)); + //@ assert ((aOpt == null) || Utils.is_(aOpt,project.quotes.AQuote.class)); project.quotes.AQuote a = project.quotes.AQuote.getInstance(); //@ assert Utils.is_(a,project.quotes.AQuote.class); { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java index d47ef655a7..c507bed2d0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java @@ -43,7 +43,7 @@ public static Object Run() { public static Number natNil() { Number ret_1 = null; - //@ assert (ret_1 == null || Utils.is_nat(ret_1)); + //@ assert ((ret_1 == null) || Utils.is_nat(ret_1)); return ret_1; } @@ -51,7 +51,7 @@ public static Number natNil() { public static Number natOne() { Number ret_2 = 1L; - //@ assert (ret_2 == null || Utils.is_nat(ret_2)); + //@ assert ((ret_2 == null) || Utils.is_nat(ret_2)); return ret_2; } From 39ad5cd5de1d395f5a2e5c12dadef9c1f0003334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 19:53:57 +0200 Subject: [PATCH 126/706] Updates to test artefacts: Changes to JML execution traces --- .../MaskedRecNamedTypeInv.vdmsl.result | 2 +- .../NamedTypeInvAsssignments.vdmsl.result | 6 +++--- .../NamedTypeInvLocalDecls.vdmsl.result | 2 +- .../NamedTypeInvMapUpdate.vdmsl.result | 2 +- .../NamedTypeInvMethodParam.vdmsl.result | 2 +- .../NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result | 6 +++--- .../NamedTypeInvSeqUpdate.vdmsl.result | 2 +- .../NamedTypeInvValues/NamedTypeInvValues.vdmsl.result | 6 +++--- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result index 6a5d36199c..7f05835ce5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result @@ -2,6 +2,6 @@ "After useOk" "Before useNotOk" Entry.java:128: JML assertion is false - //@ assert inv_Entry_T3(stateDes_8); + //@ assert (Utils.is_(stateDes_8,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_8)); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result index a92a51a39d..1a4723606f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result @@ -1,11 +1,11 @@ "Breaking named type invariant (assigning record field)" St.java:55: JML assertion is false - //@ assert project.Entry.invChecksOn ==> (inv_Entry_PT(_x) && (_x == null || inv_Entry_PossiblyOne(_x) || inv_Entry_True(_x))); + //@ assert project.Entry.invChecksOn ==> (((_x == null) || ((_x == null) || ((_x == null) || ((_x == null) || Utils.is_nat(_x)) && inv_Entry_PossiblyOne(_x)) || (Utils.is_bool(_x) && inv_Entry_True(_x))) && inv_Entry_PT(_x))); ^ St.java:58: JML assertion is false - //@ assert project.Entry.invChecksOn ==> (inv_Entry_PT(x) && (x == null || inv_Entry_PossiblyOne(x) || inv_Entry_True(x))); + //@ assert project.Entry.invChecksOn ==> (((x == null) || ((x == null) || ((x == null) || ((x == null) || Utils.is_nat(x)) && inv_Entry_PossiblyOne(x)) || (Utils.is_bool(x) && inv_Entry_True(x))) && inv_Entry_PT(x))); ^ "Breaking named type invariant (assigning local variable)" Entry.java:50: JML assertion is false - //@ assert inv_Entry_PT(p1) && (p1 == null || inv_Entry_PossiblyOne(p1) || inv_Entry_True(p1)); + //@ assert ((p1 == null) || ((p1 == null) || ((p1 == null) || ((p1 == null) || Utils.is_nat(p1)) && inv_Entry_PossiblyOne(p1)) || (Utils.is_bool(p1) && inv_Entry_True(p1))) && inv_Entry_PT(p1)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result index 2f4188d627..6570442959 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result @@ -1,5 +1,5 @@ "Before breaking named type invariant" Entry.java:34: JML assertion is false - //@ assert inv_Entry_No(notLarge) && (inv_Entry_Even(notLarge) || inv_Entry_Large(notLarge)); + //@ assert (((Utils.is_nat(notLarge) && inv_Entry_Even(notLarge)) || (Utils.is_real(notLarge) && inv_Entry_Large(notLarge))) && inv_Entry_No(notLarge)); ^ "After breaking named type invariant" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result index a06bcecbf4..2a4bc25f1e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for sequence" Entry.java:30: JML assertion is false - //@ assert inv_Entry_M(m); + //@ assert (true && inv_Entry_M(m)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result index 6576c83ece..6d1dffc995 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for method parameter" Entry.java:49: JML assertion is false - //@ assert inv_Entry_Even(c); + //@ assert (Utils.is_nat(c) && inv_Entry_Even(c)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result index 0a0922489d..11eb8bdd91 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result @@ -1,10 +1,10 @@ "Breaking named type invariant for return value" Entry.java:56: JML assertion is false - //@ assert inv_Entry_A(a) && (a == null || inv_Entry_B(a) || inv_Entry_C(a)); + //@ assert ((a == null) || ((a == null) || (Utils.is_real(a) && inv_Entry_B(a)) || (Utils.is_char(a) && inv_Entry_C(a))) && inv_Entry_A(a)); ^ Entry.java:59: JML assertion is false - //@ assert inv_Entry_A(ret_2) && (ret_2 == null || inv_Entry_B(ret_2) || inv_Entry_C(ret_2)); + //@ assert ((ret_2 == null) || ((ret_2 == null) || (Utils.is_real(ret_2) && inv_Entry_B(ret_2)) || (Utils.is_char(ret_2) && inv_Entry_C(ret_2))) && inv_Entry_A(ret_2)); ^ Entry.java:36: JML assertion is false - //@ assert inv_Entry_A(ignorePattern_6) && (ignorePattern_6 == null || inv_Entry_B(ignorePattern_6) || inv_Entry_C(ignorePattern_6)); + //@ assert ((ignorePattern_6 == null) || ((ignorePattern_6 == null) || (Utils.is_real(ignorePattern_6) && inv_Entry_B(ignorePattern_6)) || (Utils.is_char(ignorePattern_6) && inv_Entry_C(ignorePattern_6))) && inv_Entry_A(ignorePattern_6)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result index ee6e06baa2..0613f5a941 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for sequence" Entry.java:30: JML assertion is false - //@ assert inv_Entry_S(s); + //@ assert (true && inv_Entry_S(s)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/NamedTypeInvValues.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/NamedTypeInvValues.vdmsl.result index 71fb733139..485268ea2c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/NamedTypeInvValues.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/NamedTypeInvValues.vdmsl.result @@ -2,17 +2,17 @@ Entry.java:10: JML static initialization may not be correct final public class Entry { ^ Entry.java:14: Associated declaration - //@ public static invariant inv_Entry_CN(fBreak) && (inv_Entry_C(fBreak) || inv_Entry_N(fBreak)); + //@ public static invariant (((Utils.is_char(fBreak) && inv_Entry_C(fBreak)) || (Utils.is_nat(fBreak) && inv_Entry_N(fBreak))) && inv_Entry_CN(fBreak)); ^ Main.java:7: JML invariant is false on entering method project.Entry.Run() from Main.main(java.lang.String[]) project.Entry.Run(); ^ Entry.java:14: Associated declaration - //@ public static invariant inv_Entry_CN(fBreak) && (inv_Entry_C(fBreak) || inv_Entry_N(fBreak)); + //@ public static invariant (((Utils.is_char(fBreak) && inv_Entry_C(fBreak)) || (Utils.is_nat(fBreak) && inv_Entry_N(fBreak))) && inv_Entry_CN(fBreak)); ^ Entry.java:21: JML invariant is false on leaving method project.Entry.Run() public static Object Run() { ^ Entry.java:14: Associated declaration - //@ public static invariant inv_Entry_CN(fBreak) && (inv_Entry_C(fBreak) || inv_Entry_N(fBreak)); + //@ public static invariant (((Utils.is_char(fBreak) && inv_Entry_C(fBreak)) || (Utils.is_nat(fBreak) && inv_Entry_N(fBreak))) && inv_Entry_CN(fBreak)); ^ \ No newline at end of file From 92c0c4d7bfa104b1cdb1a46a1fcdd71b39d71761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 20:23:48 +0200 Subject: [PATCH 127/706] Take dynamic type check out of the invariant method And perform this type check entirely in JML --- .../overture/codegen/vdm2jml/JmlGenUtil.java | 187 ------------------ .../codegen/vdm2jml/JmlGenerator.java | 15 +- .../codegen/vdm2jml/util/IsValChecker.java | 1 - 3 files changed, 2 insertions(+), 201 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java index 8d72a7448d..905a7f1352 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java @@ -4,9 +4,7 @@ import java.util.LinkedList; import java.util.List; -import org.overture.codegen.assistant.ExpAssistantCG; import org.overture.codegen.cgast.INode; -import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.SPatternCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; @@ -17,33 +15,23 @@ import org.overture.codegen.cgast.declarations.ANamedTypeDeclCG; import org.overture.codegen.cgast.declarations.ARecordDeclCG; import org.overture.codegen.cgast.declarations.ATypeDeclCG; -import org.overture.codegen.cgast.expressions.AAndBoolBinaryExpCG; -import org.overture.codegen.cgast.expressions.AEqualsBinaryExpCG; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; -import org.overture.codegen.cgast.expressions.AOrBoolBinaryExpCG; -import org.overture.codegen.cgast.expressions.SBinaryExpCG; import org.overture.codegen.cgast.patterns.AIdentifierPatternCG; -import org.overture.codegen.cgast.statements.AIfStmCG; import org.overture.codegen.cgast.statements.AReturnStmCG; import org.overture.codegen.cgast.types.ABoolBasicTypeCG; import org.overture.codegen.cgast.types.AExternalTypeCG; import org.overture.codegen.cgast.types.AMethodTypeCG; import org.overture.codegen.ir.IRConstants; import org.overture.codegen.ir.IRStatus; -import org.overture.codegen.ir.SourceNode; import org.overture.codegen.ir.VdmNodeInfo; import org.overture.codegen.logging.Logger; import org.overture.codegen.vdm2java.JavaCodeGenUtil; import org.overture.codegen.vdm2java.JavaFormat; import org.overture.codegen.vdm2jml.data.RecClassInfo; -import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; -import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; -import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; import org.overture.codegen.vdm2jml.util.NameGen; public class JmlGenUtil { - private static final String TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG = "The Java code generator does not support checking of this type"; private JmlGenerator jmlGen; public JmlGenUtil(JmlGenerator jmlGen) @@ -368,181 +356,6 @@ public AMethodDeclCG genInvMethod(ADefaultClassDeclCG clazz, return method; } - public AIfStmCG consDynamicTypeCheck(IRStatus status, AMethodDeclCG method, - ANamedTypeDeclCG namedTypeDecl) - { - AIdentifierVarExpCG paramExp = getInvParamVar(method); - - if (paramExp == null) - { - return null; - } - - String defModule = namedTypeDecl.getName().getDefiningClass(); - String typeName = namedTypeDecl.getName().getName(); - NamedTypeInfo findTypeInfo = NamedTypeInvDepCalculator.findTypeInfo(jmlGen.getTypeInfoList(), defModule, typeName); - - List leafTypes = findTypeInfo.getLeafTypesRecursively(); - - if (leafTypes.isEmpty()) - { - Logger.getLog().printErrorln("Could not find any leaf types for named invariant type " - + findTypeInfo.getDefModule() - + "." - + findTypeInfo.getTypeName() - + " in '" - + this.getClass().getSimpleName() + "'"); - return null; - } - - // The idea is to construct a dynamic type check to make sure that the parameter value - // matches one of the leaf types, e.g. - // Utils.is_char(n) || Utils.is_nat(n) - SExpCG typeCond = null; - - ExpAssistantCG expAssist = jmlGen.getJavaGen().getInfo().getExpAssistant(); - - if (leafTypes.size() == 1) - { - LeafTypeInfo onlyLeafType = leafTypes.get(0); - - STypeCG typeCg = onlyLeafType.getType(); - - if (typeCg == null) - { - return null; - } - - typeCond = expAssist.consIsExp(paramExp, typeCg); - - if (typeCond == null) - { - SourceNode sourceNode = onlyLeafType.getType().getSourceNode(); - status.getUnsupportedInIr().add(new VdmNodeInfo(sourceNode != null ? sourceNode.getVdmNode() : null, TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); - return null; - } - } else - { - // There are two or more leaf types - - LeafTypeInfo currentLeafType = leafTypes.get(0); - STypeCG typeCg = currentLeafType.getType(); - - if (typeCg == null) - { - return null; - } - - typeCond = expAssist.consIsExp(paramExp, typeCg); - - if (typeCond == null) - { - SourceNode sourceNode = currentLeafType.getType().getSourceNode(); - status.getUnsupportedInIr().add(new VdmNodeInfo(sourceNode != null ? sourceNode.getVdmNode() : null, TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); - return null; - } - - AOrBoolBinaryExpCG topOr = new AOrBoolBinaryExpCG(); - topOr.setType(new ABoolBasicTypeCG()); - topOr.setLeft(typeCond); - - AOrBoolBinaryExpCG next = topOr; - - // Iterate all leaf types - except for the first and last ones - for (int i = 1; i < leafTypes.size() - 1; i++) - { - currentLeafType = leafTypes.get(i); - typeCg = currentLeafType.getType(); - - if (typeCg == null) - { - return null; - } - - typeCond = expAssist.consIsExp(paramExp, typeCg); - - if (typeCond == null) - { - SourceNode sourceNode = currentLeafType.getType().getSourceNode(); - status.getUnsupportedInIr().add(new VdmNodeInfo(sourceNode != null ? sourceNode.getVdmNode() : null, TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); - return null; - } - - AOrBoolBinaryExpCG tmp = new AOrBoolBinaryExpCG(); - tmp.setType(new ABoolBasicTypeCG()); - tmp.setLeft(typeCond); - - next.setRight(tmp); - next = tmp; - } - - currentLeafType = leafTypes.get(leafTypes.size() - 1); - - typeCg = currentLeafType.getType(); - - if (typeCg == null) - { - return null; - } - - typeCond = expAssist.consIsExp(paramExp, typeCg); - - if (typeCond == null) - { - SourceNode sourceNode = currentLeafType.getType().getSourceNode(); - status.getUnsupportedInIr().add(new VdmNodeInfo(sourceNode != null ? sourceNode.getVdmNode() : null, TYPE_NOT_SUPPORTED_FOR_IS_CHECK_MSG)); - return null; - } - - next.setRight(typeCond); - - typeCond = topOr; - } - - // We will negate the type check and return false if the type of the parameter - // is not any of the leaf types, e.g - // if (!(Utils.is_char(n) || Utils.is_nat(n))) { return false;} - typeCond = expAssist.negate(typeCond); - - boolean nullAllowed = findTypeInfo.allowsNull(); - - AEqualsBinaryExpCG notNull = new AEqualsBinaryExpCG(); - notNull.setType(new ABoolBasicTypeCG()); - notNull.setLeft(paramExp.clone()); - notNull.setRight(jmlGen.getJavaGen().getInfo().getExpAssistant().consNullExp()); - - SBinaryExpCG nullCheck = null; - - if (nullAllowed) - { - // If 'null' is allowed as a value we have to update the dynamic - // type check to also take this into account too, e.g. - // if (!Utils.equals(n, null) && !(Utils.is_char(n) || Utils.is_nat(n))) { return false;} - nullCheck = new AAndBoolBinaryExpCG(); - nullCheck.setLeft(jmlGen.getJavaGen().getInfo().getExpAssistant().negate(notNull)); - } else - { - // If 'null' is NOT allowed as a value we have to update the dynamic we get - // if (Utils.equals(n, null) || !(Utils.is_char(n) || Utils.is_nat(n))) { return false;} - nullCheck = new AOrBoolBinaryExpCG(); - nullCheck.setLeft(notNull); - } - - nullCheck.setType(new ABoolBasicTypeCG()); - nullCheck.setRight(typeCond); - - typeCond = nullCheck; - - AReturnStmCG returnFalse = new AReturnStmCG(); - returnFalse.setExp(jmlGen.getJavaGen().getInfo().getExpAssistant().consBoolLiteral(false)); - - AIfStmCG dynTypeCheck = new AIfStmCG(); - dynTypeCheck.setIfExp(typeCond); - dynTypeCheck.setThenStm(returnFalse); - - return dynTypeCheck; - } - public AIdentifierPatternCG consInvParamReplacementId(ADefaultClassDeclCG encClass, String originalParamName) { NameGen nameGen = new NameGen(encClass); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java index 7d9f032b84..b8f7f57432 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java @@ -25,7 +25,6 @@ import org.overture.codegen.cgast.expressions.ACastUnaryExpCG; import org.overture.codegen.cgast.expressions.AIdentifierVarExpCG; import org.overture.codegen.cgast.statements.ABlockStmCG; -import org.overture.codegen.cgast.statements.AIfStmCG; import org.overture.codegen.cgast.types.AUnknownTypeCG; import org.overture.codegen.ir.IRConstants; import org.overture.codegen.ir.IREventObserver; @@ -278,12 +277,10 @@ public List> finalIRConstructed(List> ast, // In order for a value to be compatible with a named invariant type // two conditions must be met: // - // 1) The type of the value must match one of the leaf types of the - // named invariant type, and secondly + // 1) The type of the value must match the domain type of the named + // type invariant. T = // // 2) the value must meet the invariant predicate - // - // Wrt. 1) a dynamic type check has to be added to the invariant method adjustNamedTypeInvFuncs(status); // Note that the methods contained in clazz.getMethod() include @@ -554,13 +551,6 @@ public void adjustNamedTypeInvFuncs(IRStatus status) // invariant checks and stack-overflow: inv_C(java.lang.Object)" annotator.makeHelper(method); - AIfStmCG dynTypeCheck = util.consDynamicTypeCheck(status, method, namedTypeDecl); - - if(dynTypeCheck == null) - { - continue; - } - ABlockStmCG declStmBlock = new ABlockStmCG(); if(!invMethodIsGen) @@ -586,7 +576,6 @@ public void adjustNamedTypeInvFuncs(IRStatus status) ABlockStmCG repBlock = new ABlockStmCG(); javaGen.getTransAssistant().replaceNodeWith(body, repBlock); - repBlock.getStatements().add(dynTypeCheck); repBlock.getStatements().add(declStmBlock); repBlock.getStatements().add(body); } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java index 8583f364e5..a488621090 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/IsValChecker.java @@ -8,7 +8,6 @@ import org.overture.codegen.cgast.expressions.ANewExpCG; import org.overture.codegen.cgast.expressions.ANullExpCG; import org.overture.codegen.cgast.expressions.APlusUnaryExpCG; -import org.overture.codegen.cgast.expressions.ATokenIsExpCG; import org.overture.codegen.cgast.expressions.SLiteralExpCG; import org.overture.codegen.cgast.expressions.SNumericBinaryExpCG; From 52732023df6cc885e76d08137567b82f2139fe33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 12 Oct 2015 20:24:32 +0200 Subject: [PATCH 128/706] Updates to test results due to removal of the dynamic type check from the invariant method --- .../complexstatedes/MaskedRecInvViolated/Entry.java | 5 ----- .../MaskedRecInvViolated.vdmsl.result | 10 ++-------- .../complexstatedes/MaskedRecInvViolated/R1.java | 5 ----- .../complexstatedes/MaskedRecInvViolated/R2.java | 5 ----- .../complexstatedes/MaskedRecInvViolated/R3.java | 5 ----- .../complexstatedes/MaskedRecInvViolated/R4.java | 5 ----- .../MaskedRecNamedTypeInv/Entry.java | 5 ----- .../complexstatedes/MaskedRecNamedTypeInv/R1.java | 5 ----- .../complexstatedes/MaskedRecNamedTypeInv/R2.java | 5 ----- .../complexstatedes/MaskedRecNamedTypeInv/R3.java | 5 ----- .../complexstatedes/MaskedRecNamedTypeInv/R4.java | 5 ----- .../NamedTypeInvUnionTypeRec/Entry.java | 6 ------ .../NamedTypeInvUnionTypeRec.vdmsl.result | 10 ++-------- .../NamedTypeInvUnionTypeRec/R1.java | 6 ------ .../NamedTypeInvUnionTypeRec/R2.java | 6 ------ .../NamedTypeInvUnionTypeRec/R3.java | 6 ------ .../NamedTypeInvUnionTypeRec/R4.java | 6 ------ .../complexstatedes/NamedTypeInvUnionTypeRec/X.java | 6 ------ .../NamedTypeInvAsssignments/Entry.java | 13 ------------- .../namedtypeinv/NamedTypeInvAsssignments/St.java | 13 ------------- .../namedtypeinv/NamedTypeInvLocalDecls/Entry.java | 13 ------------- .../namedtypeinv/NamedTypeInvMapUpdate/Entry.java | 5 ----- .../namedtypeinv/NamedTypeInvMethodParam/Entry.java | 4 ---- .../namedtypeinv/NamedTypeInvNullAllowed/Entry.java | 13 ------------- .../namedtypeinv/NamedTypeInvReturn/Entry.java | 13 ------------- .../namedtypeinv/NamedTypeInvSeqUpdate/Entry.java | 5 ----- .../namedtypeinv/NamedTypeInvValues/Entry.java | 13 ------------- 27 files changed, 4 insertions(+), 194 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java index 87c84a24c6..adcda6c5d2 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java @@ -172,11 +172,6 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result index bdeaf9a4f7..bffa6a165c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result @@ -1,16 +1,10 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:22: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) - public boolean equals(final Object obj) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:22: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -Entry.java:182: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:177: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) return !(Utils.equals(t3.get_r4().get_x(), 10L)); ^ -Entry.java:182: +Entry.java:177: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java index c76e4acca9..dcb71dc628 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java @@ -73,11 +73,6 @@ public static Boolean inv_R1(final project.Entrytypes.R2 _r2) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java index 58863a8ca4..cd132a3a64 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java @@ -73,11 +73,6 @@ public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java index 4ea287a65c..bbc5bf05b5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java @@ -73,11 +73,6 @@ public static Boolean inv_R3(final project.Entrytypes.R4 _r4) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java index 58135ba46b..8d0f0d4174 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java @@ -73,11 +73,6 @@ public static Boolean inv_R4(final Number _x) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java index 0f24259a88..7c240deda1 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java @@ -150,11 +150,6 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java index c76e4acca9..dcb71dc628 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java @@ -73,11 +73,6 @@ public static Boolean inv_R1(final project.Entrytypes.R2 _r2) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java index 58863a8ca4..cd132a3a64 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java @@ -73,11 +73,6 @@ public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java index 4ea287a65c..bbc5bf05b5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java @@ -73,11 +73,6 @@ public static Boolean inv_R3(final project.Entrytypes.R4 _r4) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java index 58135ba46b..8d0f0d4174 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java @@ -73,11 +73,6 @@ public static Boolean inv_R4(final Number _x) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class))) { - return false; - } - project.Entrytypes.R3 t3 = ((project.Entrytypes.R3) check_t3); return !(Utils.equals(t3.get_r4().get_x(), 10L)); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index 8dcdfa7579..ce1e7ddcae 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -208,12 +208,6 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class) || - Utils.is_(check_t3, project.Entrytypes.X.class))) { - return false; - } - Object t3 = ((Object) check_t3); Boolean andResult_1 = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result index 5e10a218ce..e1c066ba14 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result @@ -1,16 +1,10 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: JML invariant is false on leaving method project.Entrytypes.R3.equals(java.lang.Object) - public boolean equals(final Object obj) { - ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:22: - //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); - ^ -Entry.java:229: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:223: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) apply_9 = ((project.Entrytypes.R3) t3).get_r4(); ^ -Entry.java:229: +Entry.java:223: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java index cfe0a301d3..7466da7248 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java @@ -82,12 +82,6 @@ public static Boolean inv_R1(final project.Entrytypes.R2 _r2) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class) || - Utils.is_(check_t3, project.Entrytypes.X.class))) { - return false; - } - Object t3 = ((Object) check_t3); Boolean andResult_1 = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java index 3c590b57c7..0a70c0be20 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java @@ -82,12 +82,6 @@ public static Boolean inv_R2(final Object _t3) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class) || - Utils.is_(check_t3, project.Entrytypes.X.class))) { - return false; - } - Object t3 = ((Object) check_t3); Boolean andResult_1 = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java index 092d8b41cd..7496aa3fbe 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java @@ -73,12 +73,6 @@ public static Boolean inv_R3(final project.Entrytypes.R4 _r4) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class) || - Utils.is_(check_t3, project.Entrytypes.X.class))) { - return false; - } - Object t3 = ((Object) check_t3); Boolean andResult_1 = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java index 767d9ef379..4df715d3e4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java @@ -73,12 +73,6 @@ public static Boolean inv_R4(final Number _x) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class) || - Utils.is_(check_t3, project.Entrytypes.X.class))) { - return false; - } - Object t3 = ((Object) check_t3); Boolean andResult_1 = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java index f7199c0d50..89a4780943 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java @@ -66,12 +66,6 @@ public Boolean valid() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_T3(final Object check_t3) { - if ((Utils.equals(check_t3, null)) || - !(Utils.is_(check_t3, project.Entrytypes.R3.class) || - Utils.is_(check_t3, project.Entrytypes.X.class))) { - return false; - } - Object t3 = ((Object) check_t3); Boolean andResult_1 = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java index 3a38972b03..82d04f7c16 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java @@ -64,21 +64,12 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_PT(final Object check_elem) { - if (!(Utils.equals(check_elem, null)) && - !(Utils.is_nat(check_elem) || Utils.is_bool(check_elem))) { - return false; - } - return true; } /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_PossiblyOne(final Object check_p) { - if (!(Utils.equals(check_p, null)) && !(Utils.is_nat(check_p))) { - return false; - } - Number p = ((Number) check_p); Boolean orResult_1 = false; @@ -95,10 +86,6 @@ public static Boolean inv_Entry_PossiblyOne(final Object check_p) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_True(final Object check_b) { - if ((Utils.equals(check_b, null)) || !(Utils.is_bool(check_b))) { - return false; - } - Boolean b = ((Boolean) check_b); return b; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java index d14d55f2fd..49e10a4809 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java @@ -66,21 +66,12 @@ public Boolean valid() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_PT(final Object check_elem) { - if (!(Utils.equals(check_elem, null)) && - !(Utils.is_nat(check_elem) || Utils.is_bool(check_elem))) { - return false; - } - return true; } /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_PossiblyOne(final Object check_p) { - if (!(Utils.equals(check_p, null)) && !(Utils.is_nat(check_p))) { - return false; - } - Number p = ((Number) check_p); Boolean orResult_1 = false; @@ -97,10 +88,6 @@ public static Boolean inv_Entry_PossiblyOne(final Object check_p) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_True(final Object check_b) { - if ((Utils.equals(check_b, null)) || !(Utils.is_bool(check_b))) { - return false; - } - Boolean b = ((Boolean) check_b); return b; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java index 887ef62cb9..5abe4ad9c2 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java @@ -52,21 +52,12 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_No(final Object check_elem) { - if ((Utils.equals(check_elem, null)) || - !(Utils.is_nat(check_elem) || Utils.is_real(check_elem))) { - return false; - } - return true; } /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_Even(final Object check_ev) { - if ((Utils.equals(check_ev, null)) || !(Utils.is_nat(check_ev))) { - return false; - } - Number ev = ((Number) check_ev); return Utils.equals(Utils.mod(ev.longValue(), 2L), 0L); @@ -75,10 +66,6 @@ public static Boolean inv_Entry_Even(final Object check_ev) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_Large(final Object check_la) { - if ((Utils.equals(check_la, null)) || !(Utils.is_real(check_la))) { - return false; - } - Number la = ((Number) check_la); return la.doubleValue() > 1000L; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java index 10fe8df8db..a57deb19d2 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java @@ -38,11 +38,6 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_M(final Object check_m) { - if ((Utils.equals(check_m, null)) || - !(Utils.is_(check_m, VDMMap.class))) { - return false; - } - VDMMap m = ((VDMMap) check_m); Boolean forAllExpResult_1 = true; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java index eaee40b3f5..760d0b8ed6 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java @@ -60,10 +60,6 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_Even(final Object check_n) { - if ((Utils.equals(check_n, null)) || !(Utils.is_nat(check_n))) { - return false; - } - Number n = ((Number) check_n); return Utils.equals(Utils.mod(n.longValue(), 2L), 0L); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java index c6186b2cc0..683ef3a4b9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java @@ -26,31 +26,18 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_N(final Object check_elem) { - if (!(Utils.equals(check_elem, null)) && - !(Utils.is_nat(check_elem) || Utils.is_char(check_elem))) { - return false; - } - return true; } /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_X(final Object check_elem) { - if ((Utils.equals(check_elem, null)) || !(Utils.is_nat(check_elem))) { - return false; - } - return true; } /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_Y(final Object check_elem) { - if ((Utils.equals(check_elem, null)) || !(Utils.is_char(check_elem))) { - return false; - } - return true; } } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java index 7a25ee5a9d..d67efc0bc7 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java @@ -75,11 +75,6 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_A(final Object check_c) { - if (!(Utils.equals(check_c, null)) && - !(Utils.is_real(check_c) || Utils.is_char(check_c))) { - return false; - } - Object c = ((Object) check_c); Boolean orResult_1 = false; @@ -96,20 +91,12 @@ public static Boolean inv_Entry_A(final Object check_c) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_B(final Object check_elem) { - if ((Utils.equals(check_elem, null)) || !(Utils.is_real(check_elem))) { - return false; - } - return true; } /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_C(final Object check_c) { - if ((Utils.equals(check_c, null)) || !(Utils.is_char(check_c))) { - return false; - } - Character c = ((Character) check_c); Boolean orResult_2 = false; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java index 0dc42920e5..090d3500e7 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java @@ -38,11 +38,6 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_S(final Object check_s) { - if ((Utils.equals(check_s, null)) || - !(Utils.is_(check_s, VDMSeq.class))) { - return false; - } - VDMSeq s = ((VDMSeq) check_s); Boolean forAllExpResult_1 = true; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java index 2a08cfa583..bb6b10f38f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java @@ -30,11 +30,6 @@ public String toString() { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_CN(final Object check_cn) { - if ((Utils.equals(check_cn, null)) || - !(Utils.is_char(check_cn) || Utils.is_nat(check_cn))) { - return false; - } - Object cn = ((Object) check_cn); Boolean orResult_1 = false; @@ -51,20 +46,12 @@ public static Boolean inv_Entry_CN(final Object check_cn) { /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_N(final Object check_elem) { - if ((Utils.equals(check_elem, null)) || !(Utils.is_nat(check_elem))) { - return false; - } - return true; } /*@ pure @*/ /*@ helper @*/ public static Boolean inv_Entry_C(final Object check_elem) { - if ((Utils.equals(check_elem, null)) || !(Utils.is_char(check_elem))) { - return false; - } - return true; } } From 028f0fb0954ce5a57187907a5ba626efac435898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 13 Oct 2015 08:10:32 +0200 Subject: [PATCH 129/706] Add test to exercise handling of union types --- .../CharUnionEven/CharUnionEven.vdmsl | 34 +++++++++ .../CharUnionEven/CharUnionEven.vdmsl.result | 7 ++ .../uniontype/CharUnionEven/Entry.java | 69 +++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl new file mode 100644 index 0000000000..bf75d69223 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl @@ -0,0 +1,34 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +Even = nat +inv n == n mod 2 = 0; + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : char | Even = charA() in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : char | Even = charNil() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +charA : () -> char +charA () == 'a'; + +charNil : () -> [char] +charNil () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result new file mode 100644 index 0000000000..620d5be5c4 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:32: JML assertion is false + //@ assert (Utils.is_nat(ignorePattern_2) && inv_Entry_Even(ignorePattern_2)) || Utils.is_char(ignorePattern_2); + ^ +"After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java new file mode 100644 index 0000000000..1bb8387c3e --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java @@ -0,0 +1,69 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + Object ignorePattern_1 = charA(); + + //@ assert (Utils.is_nat(ignorePattern_1) && inv_Entry_Even(ignorePattern_1)) || Utils.is_char(ignorePattern_1); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + Object ignorePattern_2 = charNil(); + + //@ assert (Utils.is_nat(ignorePattern_2) && inv_Entry_Even(ignorePattern_2)) || Utils.is_char(ignorePattern_2); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static Character charA() { + Character ret_1 = 'a'; + + //@ assert Utils.is_char(ret_1); + return ret_1; + } + + /*@ pure @*/ + public static Character charNil() { + Character ret_2 = null; + + //@ assert ((ret_2 == null) || Utils.is_char(ret_2)); + return ret_2; + } + + public String toString() { + return "Entry{}"; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_Even(final Object check_n) { + Number n = ((Number) check_n); + + return Utils.equals(Utils.mod(n.longValue(), 2L), 0L); + } +} From ee701f5dc2cd77f08732b472a4b864c03c2d371f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 13 Oct 2015 08:11:16 +0200 Subject: [PATCH 130/706] Prepare unit testing of union types --- .../tests/exec/JmlUnionTypeExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlUnionTypeExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlUnionTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlUnionTypeExecTests.java new file mode 100644 index 0000000000..f126fb0c20 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlUnionTypeExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlUnionTypeExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "uniontype"; + + public static final String PROPERTY_ID = "uniontype"; + + public JmlUnionTypeExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From f1cbdc0a3ebe4d464ecdc143ed58f94c57b0167f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 13 Oct 2015 19:38:17 +0200 Subject: [PATCH 131/706] Update type info finder to use 'UnionInfo' --- .../vdm2jml/predgen/TypePredHandler.java | 46 ++++----- .../codegen/vdm2jml/predgen/TypePredUtil.java | 93 ++++++++----------- 2 files changed, 60 insertions(+), 79 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java index 385eeac4f8..3184fd32b7 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java @@ -85,13 +85,13 @@ public void handleField(AFieldDeclCG node) * So at this point it must be a value defined in a module. No need to check if invariant checks are enabled. */ - List invTypes = util.findTypeInfo(node.getType()); + AbstractTypeInfo typeInfo = util.findTypeInfo(node.getType()); - if (!invTypes.isEmpty()) + if (typeInfo != null) { AIdentifierVarExpCG var = getJmlGen().getJavaGen().getInfo().getExpAssistant().consIdVar(node.getName(), node.getType().clone()); - List invStrings = util.consJmlCheck(encClass.getName(), JmlGenerator.JML_PUBLIC, JmlGenerator.JML_STATIC_INV_ANNOTATION, false, invTypes, var); + List invStrings = util.consJmlCheck(encClass.getName(), JmlGenerator.JML_PUBLIC, JmlGenerator.JML_STATIC_INV_ANNOTATION, false, typeInfo, var); for(String invStr : invStrings) { getAnnotator().appendMetaData(node, getAnnotator().consMetaData(invStr)); @@ -170,9 +170,9 @@ public void handleReturn(AReturnStmCG node) throws AnalysisException STypeCG returnType = encMethod.getMethodType().getResult(); - List invTypes = util.findTypeInfo(returnType); + AbstractTypeInfo typeInfo = util.findTypeInfo(returnType); - if (invTypes.isEmpty()) + if (typeInfo == null) { return; } @@ -205,9 +205,9 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException ABlockStmCG replBody = new ABlockStmCG(); for (AFormalParamLocalParamCG param : node.getFormalParams()) { - List invTypes = util.findTypeInfo(param.getType()); + AbstractTypeInfo typeInfo = util.findTypeInfo(param.getType()); - if (!invTypes.isEmpty()) + if (typeInfo != null) { ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); @@ -231,7 +231,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException * Upon entering a record setter it is necessary to check if invariants checks are enabled before * checking the parameter */ - List as = util.consAssertStm(invTypes, encClassName, var, node, decorator.getRecInfo()); + List as = util.consAssertStm(typeInfo, encClassName, var, node, decorator.getRecInfo()); for(AMetaStmCG a : as) { replBody.getStatements().add(a); @@ -275,9 +275,9 @@ public List handleMapSeq(AMapSeqUpdateStmCG node) replStm.getStatements().add(node); } - List invTypes = util.findTypeInfo(var.getType()); + AbstractTypeInfo typeInfo = util.findTypeInfo(var.getType()); - if (!invTypes.isEmpty()) + if (typeInfo != null) { ADefaultClassDeclCG enclosingClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); @@ -291,7 +291,7 @@ public List handleMapSeq(AMapSeqUpdateStmCG node) /** * Updates to fields in record setters need to check if invariants checks are enabled */ - return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, decorator.getRecInfo()); + return util.consAssertStm(typeInfo, enclosingClass.getName(), var, node, decorator.getRecInfo()); } } @@ -304,9 +304,9 @@ public List handleVarDecl(AVarDeclCG node) // let x : Even = 1 in ... // (dcl y : Even | nat := 2; ...) - List invTypes = util.findTypeInfo(node.getType()); + AbstractTypeInfo typeInfo = util.findTypeInfo(node.getType()); - if (!invTypes.isEmpty()) + if (typeInfo != null) { String name = decorator.getJmlGen().getUtil().getName(node.getPattern()); @@ -328,7 +328,7 @@ public List handleVarDecl(AVarDeclCG node) * We do not really need to check if invariant checks are enabled because local variable declarations are * not expected to be found inside record accessors */ - return util.consAssertStm(invTypes, enclosingClass.getName(), var, node, decorator.getRecInfo()); + return util.consAssertStm(typeInfo, enclosingClass.getName(), var, node, decorator.getRecInfo()); } return null; @@ -362,9 +362,9 @@ public List handleCallObj(ACallObjectExpStmCG node) return null; } - List invTypes = util.findTypeInfo(recObj.getType()); + AbstractTypeInfo typeInfo = util.findTypeInfo(recObj.getType()); - if (!invTypes.isEmpty()) + if (typeInfo != null) { ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); @@ -377,7 +377,7 @@ public List handleCallObj(ACallObjectExpStmCG node) * Since setter calls can occur inside a record in the context of an atomic statement blocks we need to * check if invariant checks are enabled */ - return util.consAssertStm(invTypes, encClass.getName(), recObjVar, node, decorator.getRecInfo()); + return util.consAssertStm(typeInfo, encClass.getName(), recObjVar, node, decorator.getRecInfo()); } } else @@ -411,9 +411,9 @@ public void handleAssign(AAssignToExpStmCG node) SVarExpCG var = (SVarExpCG) target; - List invTypes = util.findTypeInfo(node.getTarget().getType()); + AbstractTypeInfo typeInfo = util.findTypeInfo(node.getTarget().getType()); - if (!invTypes.isEmpty()) + if (typeInfo != null) { ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); @@ -426,7 +426,7 @@ public void handleAssign(AAssignToExpStmCG node) * Since assignments can occur inside record setters in the context of an atomic statement block we need to * check if invariant checks are enabled */ - List asserts = util.consAssertStm(invTypes, encClass.getName(), var, node, decorator.getRecInfo()); + List asserts = util.consAssertStm(typeInfo, encClass.getName(), var, node, decorator.getRecInfo()); for(AMetaStmCG a : asserts) { @@ -488,9 +488,9 @@ public JmlGenerator getJmlGen() public List consAsserts(AIdentifierVarExpCG var) { - List invTypes = util.findTypeInfo(var.getType()); + AbstractTypeInfo typeInfo = util.findTypeInfo(var.getType()); - if (invTypes.isEmpty()) + if (typeInfo == null) { return null; } @@ -506,7 +506,7 @@ public List consAsserts(AIdentifierVarExpCG var) * Normalisation of state designators will never occur inside record classes so really there is no need to check * if invariant checks are enabled */ - return util.consAssertStm(invTypes, encClass.getName(), var, var, decorator.getRecInfo()); + return util.consAssertStm(typeInfo, encClass.getName(), var, var, decorator.getRecInfo()); } public boolean rightHandSideMayBeNull(SExpCG exp) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index 4368c982ba..5de25d9acf 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -24,6 +24,7 @@ import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; +import org.overture.codegen.vdm2jml.predgen.info.UnionInfo; public class TypePredUtil { @@ -35,14 +36,14 @@ public TypePredUtil(TypePredHandler handler) } public List consJmlCheck(String enclosingClass, String jmlVisibility, - String annotationType, boolean invChecksGuard, List typeInfoMatches, + String annotationType, boolean invChecksGuard, AbstractTypeInfo typeInfo, SVarExpCG var) { List predStrs = new LinkedList<>(); if(handler.getDecorator().buildRecValidChecks()) { - appendRecValidChecks(invChecksGuard, typeInfoMatches, var, predStrs); + appendRecValidChecks(invChecksGuard, typeInfo, var, predStrs); } StringBuilder inv = new StringBuilder(); @@ -64,24 +65,20 @@ public List consJmlCheck(String enclosingClass, String jmlVisibility, } String or = ""; - for (AbstractTypeInfo match : typeInfoMatches) + String javaPackage = handler.getJmlGen().getJavaSettings().getJavaRootPackage(); + String consCheckExp = typeInfo.consCheckExp(enclosingClass, javaPackage); + inv.append(or); + if (consCheckExp != null) { - String javaPackage = handler.getJmlGen().getJavaSettings().getJavaRootPackage(); - String consCheckExp = match.consCheckExp(enclosingClass, javaPackage); - inv.append(or); - if(consCheckExp != null) - { - inv.append(consCheckExp); - } - else - { - Logger.getLog().printErrorln("Expression could not be checked in '" - + this.getClass().getSimpleName() + "'"); - //TODO: Consider better handling - inv.append("true"); - } - or = JmlGenerator.JML_OR; + inv.append(consCheckExp); + } else + { + Logger.getLog().printErrorln("Expression could not be checked in '" + this.getClass().getSimpleName() + + "'"); + // TODO: Consider better handling + inv.append("true"); } + or = JmlGenerator.JML_OR; if(invChecksGuard) { @@ -106,10 +103,10 @@ private String consInvChecksGuard() } private void appendRecValidChecks(boolean invChecksGuard, - List typeInfoMatches, SVarExpCG var, + AbstractTypeInfo typeInfo, SVarExpCG var, List predStrs) { - List recordTypes = getRecTypes(typeInfoMatches); + List recordTypes = getRecTypes(typeInfo); if (!recordTypes.isEmpty()) { @@ -159,28 +156,24 @@ public String fullyQualifiedRecType(ARecordTypeCG rt) return fullyQualifiedRecType; } - private List getRecTypes( - List typeInfoMatches) + private List getRecTypes(AbstractTypeInfo typeInfo) { List recTypes = new LinkedList<>(); - - for (AbstractTypeInfo match : typeInfoMatches) - { - List leaves = match.getLeafTypesRecursively(); - for (LeafTypeInfo leaf : leaves) + List leaves = typeInfo.getLeafTypesRecursively(); + + for (LeafTypeInfo leaf : leaves) + { + if (leaf.getType() instanceof ARecordTypeCG) { - if (leaf.getType() instanceof ARecordTypeCG) - { - recTypes.add((ARecordTypeCG) leaf.getType()); - } + recTypes.add((ARecordTypeCG) leaf.getType()); } } return recTypes; } - public List consAssertStm(List invTypes, + public List consAssertStm(AbstractTypeInfo invTypes, String encClassName, SVarExpCG var, INode node, RecClassInfo recInfo) { boolean inAccessor = node != null && recInfo != null && recInfo.inAccessor(node); @@ -208,10 +201,8 @@ public AMetaStmCG consVarNotNullAssert(String varName) return assertStm; } - public List findTypeInfo(STypeCG type) + public AbstractTypeInfo findTypeInfo(STypeCG type) { - List posTypes = new LinkedList<>(); - if (type.getNamedInvType() != null) { ANamedTypeDeclCG namedInv = type.getNamedInvType(); @@ -221,50 +212,40 @@ public List findTypeInfo(STypeCG type) NamedTypeInfo info = NamedTypeInvDepCalculator.findTypeInfo(handler.getJmlGen().getTypeInfoList(), defModule, typeName); - if (info != null) - { - posTypes.add(info); - } else + if (info == null) { Logger.getLog().printErrorln("Could not find info for named type '" + typeName + "' defined in module '" + defModule + "' in '" + this.getClass().getSimpleName() + "'"); } + + return info; // We do not need to collect sub named invariant types } else if (type instanceof AUnionTypeCG) { + UnionInfo unionInfo = new UnionInfo(handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type)); + for (STypeCG t : ((AUnionTypeCG) type).getTypes()) { - posTypes.addAll(findTypeInfo(t)); + unionInfo.getTypes().add(findTypeInfo(t)); } + + return unionInfo; } else if(type instanceof AUnknownTypeCG) { - return posTypes; + return null; } else if(type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG || type instanceof ASeqSeqTypeCG || type instanceof ATupleTypeCG) { // Can't do anything for these right now... // TODO: implement handling - return posTypes; + return null; } else { - posTypes.add(new LeafTypeInfo(type, handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type))); + return new LeafTypeInfo(type, handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type)); } - - // We will only consider types that are disjoint. As an example consider - // the type definitions below: - // - // C = ...; N = ...; CN = C|N; - // - // Say we have the following value definition: - // - // val : CN|N - // - // Then we only want to have the type info for CN returned since N is already - // contained in CN. - return NamedTypeInvDepCalculator.onlyDisjointTypes(posTypes); } } From e18b252ab1de14332b6d49889ef334bf3f28d9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 13 Oct 2015 19:44:33 +0200 Subject: [PATCH 132/706] Minor tweaks to test results --- .../uniontype/CharUnionEven/CharUnionEven.vdmsl.result | 2 +- .../dynamic_analysis/uniontype/CharUnionEven/Entry.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result index 620d5be5c4..e0e76e2df5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result @@ -2,6 +2,6 @@ "After legal use" "Before illegal use" Entry.java:32: JML assertion is false - //@ assert (Utils.is_nat(ignorePattern_2) && inv_Entry_Even(ignorePattern_2)) || Utils.is_char(ignorePattern_2); + //@ assert ((Utils.is_nat(ignorePattern_2) && inv_Entry_Even(ignorePattern_2)) || Utils.is_char(ignorePattern_2)); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java index 1bb8387c3e..f42fd38cdc 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Object ignorePattern_1 = charA(); - //@ assert (Utils.is_nat(ignorePattern_1) && inv_Entry_Even(ignorePattern_1)) || Utils.is_char(ignorePattern_1); + //@ assert ((Utils.is_nat(ignorePattern_1) && inv_Entry_Even(ignorePattern_1)) || Utils.is_char(ignorePattern_1)); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Object ignorePattern_2 = charNil(); - //@ assert (Utils.is_nat(ignorePattern_2) && inv_Entry_Even(ignorePattern_2)) || Utils.is_char(ignorePattern_2); + //@ assert ((Utils.is_nat(ignorePattern_2) && inv_Entry_Even(ignorePattern_2)) || Utils.is_char(ignorePattern_2)); /* skip */ } From 3f5db3e7198161ee80d0468fad381c0c1d29ab49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 13 Oct 2015 19:50:12 +0200 Subject: [PATCH 133/706] Remove type info filtering since it's currently not being used. It may come back later when it's needed. --- .../predgen/info/AbstractTypeInfo.java | 2 - .../vdm2jml/predgen/info/LeafTypeInfo.java | 8 ---- .../vdm2jml/predgen/info/NamedTypeInfo.java | 22 --------- .../info/NamedTypeInvDepCalculator.java | 47 ------------------- .../vdm2jml/predgen/info/UnionInfo.java | 7 --- 5 files changed, 86 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java index 547e42fe94..a3cbab2cc7 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java @@ -17,8 +17,6 @@ public AbstractTypeInfo(boolean optional) abstract public List getLeafTypesRecursively(); - abstract public boolean contains(AbstractTypeInfo subject); - abstract public String consCheckExp(String enclosingClass, String javaRootPackage); public String consIsNullCheck() diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java index afe29acf82..170d2f4a73 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java @@ -94,14 +94,6 @@ public List getLeafTypesRecursively() return types; } - - @Override - public boolean contains(AbstractTypeInfo subject) - { - //TODO: Returning false leads to redundant dynamic type check which is not optimal - return false; - } - public String concCheckCall(String s) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java index c28b290f57..ee245cc8b7 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java @@ -35,28 +35,6 @@ public boolean hasInv() { return hasInv; } - - public boolean contains(AbstractTypeInfo other) - { - //TODO: Returning false leads to redundant dynamic type check which is not optimal - return false; - -// if (equals(other)) -// { -// return true; -// } else -// { -// for (NamedTypeInfo n : namedTypes) -// { -// if (n.contains(other)) -// { -// return true; -// } -// } -// } -// -// return false; - } @Override public int hashCode() diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index 22d88e8a0a..38b42d4097 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -47,53 +47,6 @@ public static NamedTypeInfo findTypeInfo(List typeInfoList, return null; } - public static List onlyDisjointTypes( - List typeInfo) - { - List disjointTypes = new LinkedList(); - - for (AbstractTypeInfo t : typeInfo) - { - if (!contains(disjointTypes, t)) - { - removeSmallerTypes(disjointTypes, t); - disjointTypes.add(t); - } - } - - return disjointTypes; - } - - public static void removeSmallerTypes(List disjointTypes, - AbstractTypeInfo subject) - { - List toRemove = new LinkedList<>(); - - for (AbstractTypeInfo nexType : disjointTypes) - { - if (subject.contains(nexType)) - { - toRemove.add(nexType); - } - } - - disjointTypes.removeAll(toRemove); - } - - public static boolean contains(List typeInfoList, - AbstractTypeInfo subject) - { - for (AbstractTypeInfo nextType : typeInfoList) - { - if (nextType.contains(subject)) - { - return true; - } - } - - return false; - } - public boolean containsExactly(ANamedInvariantType node) { String module = node.getName().getModule(); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java index 0d9df5da0d..b03f46d0b5 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java @@ -51,13 +51,6 @@ public List getLeafTypesRecursively() return leaves; } - - @Override - public boolean contains(AbstractTypeInfo subject) - { - //TODO: Returning false leads to redundant dynamic type check which is not optimal - return false; - } @Override public String consCheckExp(String enclosingModule, String javaRootPackage) From 465ca685297a0359eea9ad6ec103d954bfdea623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 13 Oct 2015 20:19:59 +0200 Subject: [PATCH 134/706] Add test revealing problem with handling of union types in the JML generator --- .../uniontype/OptionalBasicUnion/Entry.java | 65 +++++++++++++++++++ .../OptionalBasicUnion.vdmsl | 38 +++++++++++ .../OptionalBasicUnion.vdmsl.result | 7 ++ 3 files changed, 110 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java new file mode 100644 index 0000000000..c524a61092 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java @@ -0,0 +1,65 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + Object a = true; + //@ assert (Utils.is_bool(a) || Utils.is_char(a) || Utils.is_nat1(a)); + a = 1L; + //@ assert (Utils.is_bool(a) || Utils.is_char(a) || Utils.is_nat1(a)); + a = 'a'; + //@ assert (Utils.is_bool(a) || Utils.is_char(a) || Utils.is_nat1(a)); + a = true; + + //@ assert (Utils.is_bool(a) || Utils.is_char(a) || Utils.is_nat1(a)); + } + + { + Object b = true; + //@ assert ((b == null) || ((b == null) || Utils.is_char(b) || Utils.is_nat1(b)) || Utils.is_bool(b)); + b = null; + + //@ assert ((b == null) || ((b == null) || Utils.is_char(b) || Utils.is_nat1(b)) || Utils.is_bool(b)); + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + Object a = charNil(); + + //@ assert (Utils.is_bool(a) || Utils.is_char(a) || Utils.is_nat1(a)); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static Character charNil() { + Character ret_1 = null; + + //@ assert ((ret_1 == null) || Utils.is_char(ret_1)); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl new file mode 100644 index 0000000000..df61be0f85 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl @@ -0,0 +1,38 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + ( + dcl a : nat1 | char | bool := true; + a := 1; + a := 'a'; + a := true; + ); + ( + dcl b : [nat1 | char] | bool := true; + b := nil; + ); + IO`println("After legal use"); + IO`println("Before illegal use"); + ( + dcl a : nat1 | char | bool := charNil(); + skip; + ); + IO`println("After illegal use"); + return 0; +); + +functions + +charNil : () -> [char] +charNil () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl.result new file mode 100644 index 0000000000..d5ca06b0da --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:44: JML assertion is false + //@ assert (Utils.is_bool(a) || Utils.is_char(a) || Utils.is_nat1(a)); + ^ +"After illegal use" \ No newline at end of file From 11845351e8408d012ff0e14373e5b7965a6196df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 13 Oct 2015 20:20:38 +0200 Subject: [PATCH 135/706] Fix to optional check in IR type assistant --- .../org/overture/codegen/assistant/TypeAssistantCG.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java index 573013bc96..94f5f761fc 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java @@ -781,7 +781,14 @@ public boolean allowsNull(STypeCG type) { if(type instanceof AUnionTypeCG) { - for(STypeCG t : ((AUnionTypeCG) type).getTypes()) + AUnionTypeCG unionType = (AUnionTypeCG) type; + + if(BooleanUtils.isTrue(unionType.getOptional())) + { + return true; + } + + for(STypeCG t : unionType.getTypes()) { if(allowsNull(t)) { From 8e44d25eddab5a33d2451888e1419741be1c53f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 13 Oct 2015 21:09:12 +0200 Subject: [PATCH 136/706] Pass var to type info when constructing type check predicate --- .../codegen/vdm2jml/predgen/TypePredUtil.java | 5 ++--- .../vdm2jml/predgen/info/AbstractTypeInfo.java | 8 +++----- .../vdm2jml/predgen/info/LeafTypeInfo.java | 18 +++++++++--------- .../vdm2jml/predgen/info/NamedTypeInfo.java | 8 ++++---- .../vdm2jml/predgen/info/UnionInfo.java | 6 +++--- 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index 5de25d9acf..d1f25ca771 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -66,7 +66,7 @@ public List consJmlCheck(String enclosingClass, String jmlVisibility, String or = ""; String javaPackage = handler.getJmlGen().getJavaSettings().getJavaRootPackage(); - String consCheckExp = typeInfo.consCheckExp(enclosingClass, javaPackage); + String consCheckExp = typeInfo.consCheckExp(enclosingClass, javaPackage, var.getName()); inv.append(or); if (consCheckExp != null) { @@ -87,8 +87,7 @@ public List consJmlCheck(String enclosingClass, String jmlVisibility, inv.append(';'); - // Inject the name of the field into the expression - predStrs.add(String.format(inv.toString(), var.getName())); + predStrs.add(inv.toString()); return predStrs; } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java index a3cbab2cc7..646bd43f78 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java @@ -4,8 +4,6 @@ public abstract class AbstractTypeInfo { - public static String ARG_PLACEHOLDER = "%1$s"; - protected boolean optional; public AbstractTypeInfo(boolean optional) @@ -17,10 +15,10 @@ public AbstractTypeInfo(boolean optional) abstract public List getLeafTypesRecursively(); - abstract public String consCheckExp(String enclosingClass, String javaRootPackage); + abstract public String consCheckExp(String enclosingClass, String javaRootPackage, String var); - public String consIsNullCheck() + public String consIsNullCheck(String var) { - return "(" + ARG_PLACEHOLDER + " == null)"; + return "(" + var + " == null)"; } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java index 170d2f4a73..678b9644c8 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java @@ -95,14 +95,14 @@ public List getLeafTypesRecursively() return types; } - public String concCheckCall(String s) + public String concCheckCall(String s, String var) { - return concCheckCall(s, null); + return concCheckCall(s, null, var); } - public String concCheckCall(String s, String arg) + public String concCheckCall(String s, String arg, String var) { - String call = Utils.class.getSimpleName() + "." + s + "(" + ARG_PLACEHOLDER; + String call = Utils.class.getSimpleName() + "." + s + "(" + var; if(arg != null) { @@ -115,7 +115,7 @@ public String concCheckCall(String s, String arg) } @Override - public String consCheckExp(String enclosingClass, String javaRootPackage) + public String consCheckExp(String enclosingClass, String javaRootPackage, String var) { String methodName = utilsCallMap.get(type.getClass()); @@ -130,7 +130,7 @@ public String consCheckExp(String enclosingClass, String javaRootPackage) { String qouteValue = ((AQuoteTypeCG) type).getValue(); String quoteType = JavaQuoteValueCreator.fullyQualifiedQuoteName(javaRootPackage, qouteValue); - call = concCheckCall(methodName, quoteType + CLASS_QUALIFIER); + call = concCheckCall(methodName, quoteType + CLASS_QUALIFIER, var); } else if(type instanceof ARecordTypeCG) { @@ -140,17 +140,17 @@ else if(type instanceof ARecordTypeCG) String fullyQualifiedRecType = recPackage + "." + rt.getName().getName(); - call = concCheckCall(methodName, fullyQualifiedRecType + CLASS_QUALIFIER); + call = concCheckCall(methodName, fullyQualifiedRecType + CLASS_QUALIFIER, var); } else { - call = concCheckCall(methodName); + call = concCheckCall(methodName, var); } // If the type is optional 'null' is also a legal value if(allowsNull()) { - return "(" + consIsNullCheck() + JmlGenerator.JML_OR + call + ")"; + return "(" + consIsNullCheck(var) + JmlGenerator.JML_OR + call + ")"; } return call; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java index ee245cc8b7..72e1ec5fcc 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java @@ -90,7 +90,7 @@ public static boolean isSameTypeDef(NamedTypeInfo typeData, } @Override - public String consCheckExp(String enclosingModule, String javaRootPackages) + public String consCheckExp(String enclosingModule, String javaRootPackages, String var) { StringBuilder sb = new StringBuilder(); // // If the type is not defined in the enclosing class we use the absolute name @@ -105,13 +105,13 @@ public String consCheckExp(String enclosingModule, String javaRootPackages) if (allowsNull()) { - sb.append(consIsNullCheck()); + sb.append(consIsNullCheck(var)); sb.append(JmlGenerator.JML_OR); } if (domainType != null) { - sb.append(domainType.consCheckExp(enclosingModule, javaRootPackages)); + sb.append(domainType.consCheckExp(enclosingModule, javaRootPackages, var)); sb.append(JmlGenerator.JML_AND); } @@ -121,7 +121,7 @@ public String consCheckExp(String enclosingModule, String javaRootPackages) sb.append(typeName); sb.append('('); - sb.append(ARG_PLACEHOLDER); + sb.append(var); sb.append(')'); return "(" + sb.toString() + ")"; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java index b03f46d0b5..d2792abbd9 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java @@ -53,7 +53,7 @@ public List getLeafTypesRecursively() } @Override - public String consCheckExp(String enclosingModule, String javaRootPackage) + public String consCheckExp(String enclosingModule, String javaRootPackage, String var) { StringBuilder sb = new StringBuilder(); @@ -62,14 +62,14 @@ public String consCheckExp(String enclosingModule, String javaRootPackage) String orSep = ""; if(allowsNull()) { - sb.append(consIsNullCheck()); + sb.append(consIsNullCheck(var)); orSep = JmlGenerator.JML_OR; } for (AbstractTypeInfo currentType : types) { sb.append(orSep); - sb.append(currentType.consCheckExp(enclosingModule, javaRootPackage)); + sb.append(currentType.consCheckExp(enclosingModule, javaRootPackage, var)); orSep = JmlGenerator.JML_OR; } From bda31706126b2b48b08c1060fc9f793cae7a6c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 08:07:12 +0200 Subject: [PATCH 137/706] More appropriate naming in type info classes --- .../codegen/vdm2jml/predgen/info/AbstractTypeInfo.java | 6 +++--- .../codegen/vdm2jml/predgen/info/LeafTypeInfo.java | 4 ++-- .../codegen/vdm2jml/predgen/info/NamedTypeInfo.java | 8 ++++---- .../overture/codegen/vdm2jml/predgen/info/UnionInfo.java | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java index 646bd43f78..fc03c6d879 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java @@ -15,10 +15,10 @@ public AbstractTypeInfo(boolean optional) abstract public List getLeafTypesRecursively(); - abstract public String consCheckExp(String enclosingClass, String javaRootPackage, String var); + abstract public String consCheckExp(String enclosingClass, String javaRootPackage, String arg); - public String consIsNullCheck(String var) + public String consIsNullCheck(String arg) { - return "(" + var + " == null)"; + return "(" + arg + " == null)"; } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java index 678b9644c8..654c0fdcf7 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java @@ -95,9 +95,9 @@ public List getLeafTypesRecursively() return types; } - public String concCheckCall(String s, String var) + public String concCheckCall(String methodName, String arg) { - return concCheckCall(s, null, var); + return concCheckCall(methodName, null, arg); } public String concCheckCall(String s, String arg, String var) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java index 72e1ec5fcc..63ed4f5d1a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java @@ -90,7 +90,7 @@ public static boolean isSameTypeDef(NamedTypeInfo typeData, } @Override - public String consCheckExp(String enclosingModule, String javaRootPackages, String var) + public String consCheckExp(String enclosingModule, String javaRootPackages, String arg) { StringBuilder sb = new StringBuilder(); // // If the type is not defined in the enclosing class we use the absolute name @@ -105,13 +105,13 @@ public String consCheckExp(String enclosingModule, String javaRootPackages, Stri if (allowsNull()) { - sb.append(consIsNullCheck(var)); + sb.append(consIsNullCheck(arg)); sb.append(JmlGenerator.JML_OR); } if (domainType != null) { - sb.append(domainType.consCheckExp(enclosingModule, javaRootPackages, var)); + sb.append(domainType.consCheckExp(enclosingModule, javaRootPackages, arg)); sb.append(JmlGenerator.JML_AND); } @@ -121,7 +121,7 @@ public String consCheckExp(String enclosingModule, String javaRootPackages, Stri sb.append(typeName); sb.append('('); - sb.append(var); + sb.append(arg); sb.append(')'); return "(" + sb.toString() + ")"; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java index d2792abbd9..cb3bb4995f 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java @@ -53,7 +53,7 @@ public List getLeafTypesRecursively() } @Override - public String consCheckExp(String enclosingModule, String javaRootPackage, String var) + public String consCheckExp(String enclosingModule, String javaRootPackage, String arg) { StringBuilder sb = new StringBuilder(); @@ -62,14 +62,14 @@ public String consCheckExp(String enclosingModule, String javaRootPackage, Strin String orSep = ""; if(allowsNull()) { - sb.append(consIsNullCheck(var)); + sb.append(consIsNullCheck(arg)); orSep = JmlGenerator.JML_OR; } for (AbstractTypeInfo currentType : types) { sb.append(orSep); - sb.append(currentType.consCheckExp(enclosingModule, javaRootPackage, var)); + sb.append(currentType.consCheckExp(enclosingModule, javaRootPackage, arg)); orSep = JmlGenerator.JML_OR; } From db3ea8066d8102f2f029de02c6cb9410c2772353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 08:38:25 +0200 Subject: [PATCH 138/706] Refactoring of type info related functionality --- .../predgen/info/AbstractTypeInfo.java | 19 +++++++++ .../vdm2jml/predgen/info/LeafTypeInfo.java | 39 +++++++------------ 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java index fc03c6d879..d51a7e9010 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java @@ -21,4 +21,23 @@ public String consIsNullCheck(String arg) { return "(" + arg + " == null)"; } + + public static String consSubjectCheck(String className, String methodName, String subject) + { + return consSubjectCheckExtraArg(className, methodName, subject, null); + } + + public static String consSubjectCheckExtraArg(String className, String methodName, String subject, String arg) + { + String call = className + "." + methodName + "(" + subject; + + if(arg != null) + { + call += "," + arg; + } + + call += ")"; + + return call; + } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java index 654c0fdcf7..f9109e6da2 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java @@ -95,27 +95,8 @@ public List getLeafTypesRecursively() return types; } - public String concCheckCall(String methodName, String arg) - { - return concCheckCall(methodName, null, arg); - } - - public String concCheckCall(String s, String arg, String var) - { - String call = Utils.class.getSimpleName() + "." + s + "(" + var; - - if(arg != null) - { - call += "," + arg; - } - - call += ")"; - - return call; - } - @Override - public String consCheckExp(String enclosingClass, String javaRootPackage, String var) + public String consCheckExp(String enclosingClass, String javaRootPackage, String arg) { String methodName = utilsCallMap.get(type.getClass()); @@ -130,7 +111,7 @@ public String consCheckExp(String enclosingClass, String javaRootPackage, String { String qouteValue = ((AQuoteTypeCG) type).getValue(); String quoteType = JavaQuoteValueCreator.fullyQualifiedQuoteName(javaRootPackage, qouteValue); - call = concCheckCall(methodName, quoteType + CLASS_QUALIFIER, var); + call = consSubjectCheckForType(methodName, arg, quoteType); } else if(type instanceof ARecordTypeCG) { @@ -140,21 +121,31 @@ else if(type instanceof ARecordTypeCG) String fullyQualifiedRecType = recPackage + "." + rt.getName().getName(); - call = concCheckCall(methodName, fullyQualifiedRecType + CLASS_QUALIFIER, var); + call = consSubjectCheckForType(methodName, arg, fullyQualifiedRecType); } else { - call = concCheckCall(methodName, var); + call = consSubjectCheck(methodName, arg); } // If the type is optional 'null' is also a legal value if(allowsNull()) { - return "(" + consIsNullCheck(var) + JmlGenerator.JML_OR + call + ")"; + return "(" + consIsNullCheck(arg) + JmlGenerator.JML_OR + call + ")"; } return call; } + + private String consSubjectCheck(String methodName, String arg) + { + return consSubjectCheck(Utils.class.getSimpleName(), methodName, arg); + } + + private String consSubjectCheckForType(String methodName, String arg, String type) + { + return consSubjectCheckExtraArg(Utils.class.getSimpleName(), methodName, arg, type + CLASS_QUALIFIER); + } public static Map, String> getUtilsCallMap() { From 1d55c5fc68b6070f80f357373a7bc59dcc6ecf23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 10:37:22 +0200 Subject: [PATCH 139/706] Renaming test for consistency --- ...tionalTypeExecTests.java => JmlOptionalTypeExecTests.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/{OptionalTypeExecTests.java => JmlOptionalTypeExecTests.java} (87%) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/OptionalTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlOptionalTypeExecTests.java similarity index 87% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/OptionalTypeExecTests.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlOptionalTypeExecTests.java index 5738452f4e..8685f3a2f5 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/OptionalTypeExecTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlOptionalTypeExecTests.java @@ -10,13 +10,13 @@ import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) -public class OptionalTypeExecTests extends JmlExecTestBase +public class JmlOptionalTypeExecTests extends JmlExecTestBase { public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "optionaltype"; public static final String PROPERTY_ID = "optionaltype"; - public OptionalTypeExecTests(File inputFile) + public JmlOptionalTypeExecTests(File inputFile) { super(inputFile); } From bbb7a2454b6052431314c9f7be5364194ea57dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 10:49:37 +0200 Subject: [PATCH 140/706] Integrate TupleInfo into the type info hierarchy --- .../codegen/vdm2jml/predgen/TypePredUtil.java | 12 +++ .../info/NamedTypeInvDepCalculator.java | 19 ++++- .../vdm2jml/predgen/info/TupleInfo.java | 83 +++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index d1f25ca771..fc013907a8 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -24,6 +24,7 @@ import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; +import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; import org.overture.codegen.vdm2jml.predgen.info.UnionInfo; public class TypePredUtil @@ -232,6 +233,17 @@ public AbstractTypeInfo findTypeInfo(STypeCG type) return unionInfo; } + else if(type instanceof ATupleTypeCG) + { + TupleInfo tupleInfo = new TupleInfo(handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type)); + + for(STypeCG t : ((ATupleTypeCG) type).getTypes()) + { + tupleInfo.getTypes().add(findTypeInfo(t)); + } + + return tupleInfo; + } else if(type instanceof AUnknownTypeCG) { return null; diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index 38b42d4097..b0ad0ebce9 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -10,6 +10,7 @@ import org.overture.ast.types.ABracketType; import org.overture.ast.types.ANamedInvariantType; import org.overture.ast.types.AOptionalType; +import org.overture.ast.types.AProductType; import org.overture.ast.types.AUnionType; import org.overture.ast.types.PType; import org.overture.codegen.cgast.STypeCG; @@ -135,7 +136,23 @@ private static AbstractTypeInfo create(IRInfo info, PType type, Set visit return unionInfo; - } else + } else if(type instanceof AProductType) + { + TupleInfo tupleInfo = new TupleInfo(optional); + + for(PType t : ((AProductType) type).getTypes()) + { + AbstractTypeInfo tInfo = create(info, t, visited); + + if(tInfo != null) + { + tupleInfo.getTypes().add(tInfo); + } + } + + return tupleInfo; + } + else { return new LeafTypeInfo(toIrType(type, info), optional); } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java new file mode 100644 index 0000000000..0284e48ecc --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java @@ -0,0 +1,83 @@ +package org.overture.codegen.vdm2jml.predgen.info; + +import java.util.LinkedList; +import java.util.List; + +import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.JmlGenerator; + +public class TupleInfo extends AbstractTypeInfo +{ + public static final String IS_TUP_METHOD_NAME = "isTup"; + public static final String GET_FIELD_METHOD_NAME = "field"; + + private List types; + + public TupleInfo(boolean optional) + { + super(optional); + this.types = new LinkedList<>(); + } + + public List getTypes() + { + return types; + } + + @Override + public boolean allowsNull() + { + if(optional) + { + return true; + } + + for(AbstractTypeInfo t : types) + { + if(t.allowsNull()) + { + return true; + } + } + + return false; + } + + @Override + public List getLeafTypesRecursively() + { + List leaves = new LinkedList<>(); + + for(AbstractTypeInfo t : types) + { + leaves.addAll(t.getLeafTypesRecursively()); + } + + return leaves; + } + + @Override + public String consCheckExp(String enclosingClass, String javaRootPackage, String arg) + { + StringBuilder sb = new StringBuilder(); + + //e.g. V2J.isTup(t) + sb.append(consSubjectCheck(V2J.class.getSimpleName(), IS_TUP_METHOD_NAME, arg)); + + for(int i = 0; i < types.size(); i++) + { + //e.g. V2J.field(t,2) + String fieldArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_FIELD_METHOD_NAME, arg, i + ""); + + //e.g. Utils.is_nat1(V2J.field(t,2)) + String fieldCheck = types.get(i).consCheckExp(enclosingClass, javaRootPackage, fieldArg); + + sb.append(JmlGenerator.JML_AND); + sb.append(fieldCheck); + } + + //e.g. (V2J.isTup(t) && Utils.is_nat1(V2J.field(t,1)) && Utils.is_bool(V2J.field(t,2))) + return "(" + sb.toString() + ")"; + } + +} From cde3a646a59dcbec68b0f523f4106171a6b237f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 10:50:34 +0200 Subject: [PATCH 141/706] Prepare testing of JML generation of tuple types --- .../tests/exec/JmlTupleTypeExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlTupleTypeExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlTupleTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlTupleTypeExecTests.java new file mode 100644 index 0000000000..4619a7619d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlTupleTypeExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlTupleTypeExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "tupletype"; + + public static final String PROPERTY_ID = "tupletype"; + + public JmlTupleTypeExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From abee5c71afb47f7bf816670cdfc7320cef0cf9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 10:55:21 +0200 Subject: [PATCH 142/706] Add tests to exercise handling of tuple types --- .../tupletype/NatBoolNegField/Entry.java | 53 ++++++++++++++++ .../NatBoolNegField/NatBoolNegField.vdmsl | 26 ++++++++ .../NatBoolNegField.vdmsl.result | 7 +++ .../tupletype/NatBoolTupNil/Entry.java | 61 +++++++++++++++++++ .../NatBoolTupNil/NatBoolTupNil.vdmsl | 29 +++++++++ .../NatBoolTupNil/NatBoolTupNil.vdmsl.result | 7 +++ 6 files changed, 183 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java new file mode 100644 index 0000000000..2d83de3bf4 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java @@ -0,0 +1,53 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + Tuple ignorePattern_1 = Tuple.mk_(1L, true); + + //@ assert (V2J.isTup(ignorePattern_1) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + Tuple ignorePattern_2 = Tuple.mk_(negInt(), true); + + //@ assert (V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static Number negInt() { + Number ret_1 = -1L; + + //@ assert Utils.is_int(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl new file mode 100644 index 0000000000..650c3bfdb3 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl @@ -0,0 +1,26 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : nat * bool = mk_(1,true) in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : nat * bool = mk_(negInt(),true) in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +negInt : () -> int +negInt () == -1; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result new file mode 100644 index 0000000000..b0cedee202 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:32: JML assertion is false + //@ assert (V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); + ^ +"After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java new file mode 100644 index 0000000000..88c8c37f47 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java @@ -0,0 +1,61 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + Tuple ignorePattern_1 = Tuple.mk_(1L, true); + + //@ assert (V2J.isTup(ignorePattern_1) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + Tuple ignorePattern_2 = TupNil(); + + //@ assert (V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static Tuple TupNil() { + Tuple ret_1 = null; + + //@ assert ((ret_1 == null) || (V2J.isTup(ret_1) && Utils.is_nat1(V2J.field(ret_1,0)) && Utils.is_bool(V2J.field(ret_1,1)))); + return Utils.copy(ret_1); + } + + /*@ pure @*/ + public static Tuple TupVal() { + Tuple ret_2 = Tuple.mk_(1L, false); + + //@ assert ((ret_2 == null) || (V2J.isTup(ret_2) && Utils.is_nat1(V2J.field(ret_2,0)) && Utils.is_bool(V2J.field(ret_2,1)))); + return Utils.copy(ret_2); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl new file mode 100644 index 0000000000..e04c101475 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl @@ -0,0 +1,29 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : nat * bool = mk_(1,true) in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : nat * bool = TupNil() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +TupNil : () -> [nat1 * bool] +TupNil () == nil; + +TupVal : () -> [nat1 * bool] +TupVal () == mk_(1,false); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result new file mode 100644 index 0000000000..b0cedee202 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:32: JML assertion is false + //@ assert (V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); + ^ +"After illegal use" \ No newline at end of file From 520d4417a7d927760cee4e33864371623d8531c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 11:18:45 +0200 Subject: [PATCH 143/706] Fix to construction of tuple check: forgot to take type optionality into account --- .../codegen/vdm2jml/predgen/info/TupleInfo.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java index 0284e48ecc..eda2b35ac5 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java @@ -76,8 +76,18 @@ public String consCheckExp(String enclosingClass, String javaRootPackage, String sb.append(fieldCheck); } - //e.g. (V2J.isTup(t) && Utils.is_nat1(V2J.field(t,1)) && Utils.is_bool(V2J.field(t,2))) - return "(" + sb.toString() + ")"; + String tupleCheck = "(" + sb.toString() + ")"; + + if(allowsNull()) + { + return "(" + consIsNullCheck(arg) + JmlGenerator.JML_OR + tupleCheck + ")"; + } + else + { + //e.g. (V2J.isTup(t) && Utils.is_nat1(V2J.field(t,1)) && Utils.is_bool(V2J.field(t,2))) + return tupleCheck; + } + } } From 5b0d09e567d352c4fe0f419fc56625f10cf11096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 11:28:10 +0200 Subject: [PATCH 144/706] Add test to exercise combined checking of a tuple type masked as a named type invariant --- .../NatBoolBasedNamedTypeInv/Entry.java | 69 +++++++++++++++++++ .../NatBooolBasedNamedTypeInv.vdmsl | 27 ++++++++ .../NatBooolBasedNamedTypeInv.vdmsl.result | 10 +++ 3 files changed, 106 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java new file mode 100644 index 0000000000..99eca11d3e --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java @@ -0,0 +1,69 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + Tuple ignorePattern_1 = Tuple.mk_(1001L, true); + + //@ assert ((V2J.isTup(ignorePattern_1) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))) && inv_Entry_TrueEven(ignorePattern_1)); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal uses"); + + { + Tuple ignorePattern_2 = Tuple.mk_(1000L, true); + + //@ assert ((V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))) && inv_Entry_TrueEven(ignorePattern_2)); + + /* skip */ + } + + { + Tuple ignorePattern_3 = Tuple.mk_(1001L, false); + + //@ assert ((V2J.isTup(ignorePattern_3) && Utils.is_nat(V2J.field(ignorePattern_3,0)) && Utils.is_bool(V2J.field(ignorePattern_3,1))) && inv_Entry_TrueEven(ignorePattern_3)); + + /* skip */ + } + + IO.println("After illegal uses"); + + return 0L; + } + + public String toString() { + return "Entry{}"; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_TrueEven(final Object check_te) { + Tuple te = ((Tuple) check_te); + + Boolean andResult_1 = false; + + if (((Number) te.get(0)).longValue() > 1000L) { + if (((Boolean) te.get(1))) { + andResult_1 = true; + } + } + + return andResult_1; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl new file mode 100644 index 0000000000..1801e1037e --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl @@ -0,0 +1,27 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +TrueEven = nat * bool +inv te == te.#1 > 1000 and te.#2; + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : TrueEven = mk_(1001,true) in skip; + IO`println("After legal use"); + IO`println("Before illegal uses"); + let - : TrueEven = mk_(1000,true) in skip; + let - : TrueEven = mk_(1001,false) in skip; + IO`println("After illegal uses"); + return 0; +); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result new file mode 100644 index 0000000000..769efe73e9 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result @@ -0,0 +1,10 @@ +"Before legal use" +"After legal use" +"Before illegal uses" +Entry.java:32: JML assertion is false + //@ assert ((V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))) && inv_Entry_TrueEven(ignorePattern_2)); + ^ +Entry.java:40: JML assertion is false + //@ assert ((V2J.isTup(ignorePattern_3) && Utils.is_nat(V2J.field(ignorePattern_3,0)) && Utils.is_bool(V2J.field(ignorePattern_3,1))) && inv_Entry_TrueEven(ignorePattern_3)); + ^ +"After illegal uses" \ No newline at end of file From effde01065e0b57e9231a57cd6bcd0d882dd2559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 19:43:09 +0200 Subject: [PATCH 145/706] Prepare testing of JML generation of sequence types --- .../tests/exec/JmlSeqTypeExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeqTypeExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeqTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeqTypeExecTests.java new file mode 100644 index 0000000000..694d4259c8 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeqTypeExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlSeqTypeExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "seqtype"; + + public static final String PROPERTY_ID = "seqtype"; + + public JmlSeqTypeExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From a953e7d0386ecfc2c6593b9aece31924a0df6616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 19:50:35 +0200 Subject: [PATCH 146/706] Add test to exercise checking of sequence types --- .../seqtype/SeqOfNatNilElem/Entry.java | 53 +++++++++++++++++++ .../SeqOfNatNilElem/SeqOfNatNilElem.vdmsl | 26 +++++++++ .../SeqOfNatNilElem.vdmsl.result | 7 +++ 3 files changed, 86 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java new file mode 100644 index 0000000000..2d4cd40623 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java @@ -0,0 +1,53 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMSeq ignorePattern_1 = SeqUtil.seq(1L, 2L, 3L); + + //@ assert (V2J.isSeq(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat(V2J.get(ignorePattern_1,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal uses"); + + { + VDMSeq ignorePattern_2 = seqOfNatsAndNil(); + + //@ assert (V2J.isSeq(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After illegal uses"); + + return 0L; + } + + /*@ pure @*/ + public static VDMSeq seqOfNatsAndNil() { + VDMSeq ret_1 = SeqUtil.seq(1L, null, 3L); + + //@ assert (V2J.isSeq(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); ((V2J.get(ret_1,i) == null) || Utils.is_nat(V2J.get(ret_1,i))))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl new file mode 100644 index 0000000000..e671634f3f --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl @@ -0,0 +1,26 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : seq of nat = [1,2,3] in skip; + IO`println("After legal use"); + IO`println("Before illegal uses"); + let - : seq of nat = seqOfNatsAndNil() in skip; + IO`println("After illegal uses"); + return 0; +); + +functions + +seqOfNatsAndNil : () -> seq of [nat] +seqOfNatsAndNil () == [1,nil,3]; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl.result new file mode 100644 index 0000000000..6b4450b9dd --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal uses" +Entry.java:32: JML assertion is false + //@ assert (V2J.isSeq(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); + ^ +"After illegal uses" \ No newline at end of file From cc10ef2ff69bb18b416d64c29e12c0c735dc526f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 22:52:55 +0200 Subject: [PATCH 147/706] Small changes to test results --- .../namedtypeinv/NamedTypeInvSeqUpdate/Entry.java | 8 ++++---- .../NamedTypeInvSeqUpdate.vdmsl.result | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java index 090d3500e7..ab94ed4b8a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java @@ -14,20 +14,20 @@ private Entry() { public static Object Run() { VDMSeq s = SeqUtil.seq(10L, 11L, 12L); - //@ assert (true && inv_Entry_S(s)); + //@ assert ((V2J.isSeq(s) && (\forall int i; 0 <= i && i < V2J.size(s); true)) && inv_Entry_S(s)); //@ assert s != null; Utils.mapSeqUpdate(s, 1L, 'a'); - //@ assert (true && inv_Entry_S(s)); + //@ assert ((V2J.isSeq(s) && (\forall int i; 0 <= i && i < V2J.size(s); true)) && inv_Entry_S(s)); //@ assert s != null; Utils.mapSeqUpdate(s, 2L, null); - //@ assert (true && inv_Entry_S(s)); + //@ assert ((V2J.isSeq(s) && (\forall int i; 0 <= i && i < V2J.size(s); true)) && inv_Entry_S(s)); IO.println("Breaking named type invariant for sequence"); //@ assert s != null; Utils.mapSeqUpdate(s, 3L, 4L); - //@ assert (true && inv_Entry_S(s)); + //@ assert ((V2J.isSeq(s) && (\forall int i; 0 <= i && i < V2J.size(s); true)) && inv_Entry_S(s)); return 0L; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result index 0613f5a941..cc7f059410 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for sequence" Entry.java:30: JML assertion is false - //@ assert (true && inv_Entry_S(s)); + //@ assert ((V2J.isSeq(s) && (\forall int i; 0 <= i && i < V2J.size(s); true)) && inv_Entry_S(s)); ^ \ No newline at end of file From 61e9255ff3a92604a6abf31c91522a7f219f2fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 22:58:51 +0200 Subject: [PATCH 148/706] Add support for checking of sequence types --- .../codegen/vdm2jml/predgen/TypePredUtil.java | 18 ++++- .../info/NamedTypeInvDepCalculator.java | 7 ++ .../codegen/vdm2jml/predgen/info/SeqInfo.java | 67 +++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index fc013907a8..92a6f052ea 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -24,6 +24,7 @@ import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; +import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; import org.overture.codegen.vdm2jml.predgen.info.UnionInfo; @@ -248,7 +249,22 @@ else if(type instanceof AUnknownTypeCG) { return null; } - else if(type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG || type instanceof ASeqSeqTypeCG || type instanceof ATupleTypeCG) + else if(type instanceof ASeqSeqTypeCG) + { + STypeCG t = ((ASeqSeqTypeCG) type).getSeqOf(); + + AbstractTypeInfo elementInfo = findTypeInfo(t); + + if(elementInfo != null) + { + return new SeqInfo(handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type), elementInfo); + } + else + { + return null; + } + } + else if(type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG || type instanceof ATupleTypeCG) { // Can't do anything for these right now... // TODO: implement handling diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index b0ad0ebce9..8b999be632 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -13,6 +13,7 @@ import org.overture.ast.types.AProductType; import org.overture.ast.types.AUnionType; import org.overture.ast.types.PType; +import org.overture.ast.types.SSeqType; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.ir.IRInfo; import org.overture.codegen.logging.Logger; @@ -152,6 +153,12 @@ private static AbstractTypeInfo create(IRInfo info, PType type, Set visit return tupleInfo; } + else if(type instanceof SSeqType) + { + SSeqType seqType = (SSeqType) type; + + return new SeqInfo(optional, create(info, seqType.getSeqof(), visited)); + } else { return new LeafTypeInfo(toIrType(type, info), optional); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java new file mode 100644 index 0000000000..356b0e2743 --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java @@ -0,0 +1,67 @@ +package org.overture.codegen.vdm2jml.predgen.info; + +import java.util.LinkedList; +import java.util.List; + +import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.JmlGenerator; + +public class SeqInfo extends AbstractTypeInfo +{ + public static final String GET_METHOD = "get"; + public static final String ITE_VAR_NAME = "i"; + public static final String SIZE__METHOD = "size"; + public static final String IS_SEQ_METHOD = "isSeq"; + + private AbstractTypeInfo elementType; + + public SeqInfo(boolean optional, AbstractTypeInfo elementType) + { + super(optional); + this.elementType = elementType; + } + + @Override + public boolean allowsNull() + { + return optional; + } + + @Override + public List getLeafTypesRecursively() + { + return new LinkedList<>(); + } + + @Override + public String consCheckExp(String enclosingClass, String javaRootPackage, String arg) + { + String isSeqCheck = consSubjectCheck(V2J.class.getSimpleName(), IS_SEQ_METHOD, arg); + String sizeCall = consSubjectCheck(V2J.class.getSimpleName(), SIZE__METHOD, arg); + String elemtnArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_METHOD, arg, ITE_VAR_NAME); + String elemtCheck = elementType.consCheckExp(enclosingClass, javaRootPackage, elemtnArg); + + StringBuilder sb = new StringBuilder(); + sb.append(isSeqCheck); + sb.append(JmlGenerator.JML_AND); + sb.append('('); + sb.append("\\forall int i; 0 <= i && i < "); + sb.append(sizeCall); + sb.append("; "); + sb.append(elemtCheck); + sb.append(')'); + + // (V2J.isSeq(seq) && (\forall int i; 0 <= i && i < V2JL.size(seq); Utils.is_nat(V2JL.get(seq,i)))); + String seqCheckExp = "(" + sb.toString() + ")"; + + if(allowsNull()) + { + return "(" + consIsNullCheck(arg) + JmlGenerator.JML_OR + seqCheckExp + ")"; + } + else + { + return seqCheckExp; + } + } + +} From 69aff8968b2357aee693af88651ad127ec01cad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 23:28:02 +0200 Subject: [PATCH 149/706] Expect more assertions in 'ModuleStateInvTests' --- .../java/org/overture/vdm2jml/tests/ModuleStateInvTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java index 99aed82910..0612a7e9d4 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java @@ -125,14 +125,14 @@ public void updateFieldAtomic() public void updateSeqElem() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("assignS", Update.MAP_SEQ_UPDATE, 4); + checkAssertion("assignS", Update.MAP_SEQ_UPDATE, 5); } @Test public void updateSeqElemAtomic() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("atomicAssignS", Update.MAP_SEQ_UPDATE, 4); + checkAssertion("atomicAssignS", Update.MAP_SEQ_UPDATE, 5); } @Test From 1debeb0768422b20552e031e20609ae0f6bfe091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 14 Oct 2015 23:59:17 +0200 Subject: [PATCH 150/706] Expect more assertions for 'ModuleStateInvComplexTests' --- .../overture/vdm2jml/tests/ModuleStateInvComplexTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java index 3be3cbdc0d..470a66ebee 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java @@ -17,7 +17,7 @@ public static void init() throws AnalysisException public void seqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("seqField", Update.SET_CALL, 4); + ModuleStateInvTests.checkAssertion("seqField", Update.SET_CALL, 5); } @Test @@ -31,13 +31,13 @@ public void mapField() public void fieldSeqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("fieldSeqField", Update.SET_CALL, 6); + ModuleStateInvTests.checkAssertion("fieldSeqField", Update.SET_CALL, 7); } @Test public void seqSeqField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("seqSeqField", Update.SET_CALL, 4); + ModuleStateInvTests.checkAssertion("seqSeqField", Update.SET_CALL, 6); } } From 684d3449e48d9c003a86c01466ac69cb06f339af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 00:08:06 +0200 Subject: [PATCH 151/706] Allow type info classes to construct and use temporary variables in the dynamic type check predicate --- .../codegen/vdm2jml/predgen/TypePredUtil.java | 7 ++++++- .../vdm2jml/predgen/info/AbstractTypeInfo.java | 4 +++- .../codegen/vdm2jml/predgen/info/LeafTypeInfo.java | 3 ++- .../codegen/vdm2jml/predgen/info/NamedTypeInfo.java | 5 +++-- .../codegen/vdm2jml/predgen/info/SeqInfo.java | 12 +++++++----- .../codegen/vdm2jml/predgen/info/TupleInfo.java | 5 +++-- .../codegen/vdm2jml/predgen/info/UnionInfo.java | 5 +++-- .../org/overture/codegen/vdm2jml/util/NameGen.java | 9 +++++++-- 8 files changed, 34 insertions(+), 16 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index 92a6f052ea..7b075dca64 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -27,6 +27,7 @@ import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; import org.overture.codegen.vdm2jml.predgen.info.UnionInfo; +import org.overture.codegen.vdm2jml.util.NameGen; public class TypePredUtil { @@ -68,7 +69,11 @@ public List consJmlCheck(String enclosingClass, String jmlVisibility, String or = ""; String javaPackage = handler.getJmlGen().getJavaSettings().getJavaRootPackage(); - String consCheckExp = typeInfo.consCheckExp(enclosingClass, javaPackage, var.getName()); + + //TODO: Add names of parameters of the enclosing method to 'names-to-avoid' in name generator + NameGen nameGen = new NameGen(); + String consCheckExp = typeInfo.consCheckExp(enclosingClass, javaPackage, var.getName(), nameGen); + inv.append(or); if (consCheckExp != null) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java index d51a7e9010..0b698187f8 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractTypeInfo.java @@ -2,6 +2,8 @@ import java.util.List; +import org.overture.codegen.vdm2jml.util.NameGen; + public abstract class AbstractTypeInfo { protected boolean optional; @@ -15,7 +17,7 @@ public AbstractTypeInfo(boolean optional) abstract public List getLeafTypesRecursively(); - abstract public String consCheckExp(String enclosingClass, String javaRootPackage, String arg); + abstract public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen); public String consIsNullCheck(String arg) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java index f9109e6da2..07658f280f 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java @@ -21,6 +21,7 @@ import org.overture.codegen.vdm2java.JavaQuoteValueCreator; import org.overture.codegen.vdm2jml.JmlGenUtil; import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.util.NameGen; public class LeafTypeInfo extends AbstractTypeInfo { @@ -96,7 +97,7 @@ public List getLeafTypesRecursively() } @Override - public String consCheckExp(String enclosingClass, String javaRootPackage, String arg) + public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) { String methodName = utilsCallMap.get(type.getClass()); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java index 63ed4f5d1a..49bf184bfa 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java @@ -4,6 +4,7 @@ import java.util.List; import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.util.NameGen; public class NamedTypeInfo extends AbstractTypeInfo { @@ -90,7 +91,7 @@ public static boolean isSameTypeDef(NamedTypeInfo typeData, } @Override - public String consCheckExp(String enclosingModule, String javaRootPackages, String arg) + public String consCheckExp(String enclosingModule, String javaRootPackages, String arg, NameGen nameGen) { StringBuilder sb = new StringBuilder(); // // If the type is not defined in the enclosing class we use the absolute name @@ -111,7 +112,7 @@ public String consCheckExp(String enclosingModule, String javaRootPackages, Stri if (domainType != null) { - sb.append(domainType.consCheckExp(enclosingModule, javaRootPackages, arg)); + sb.append(domainType.consCheckExp(enclosingModule, javaRootPackages, arg, nameGen)); sb.append(JmlGenerator.JML_AND); } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java index 356b0e2743..eac4bbd0d2 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java @@ -5,11 +5,12 @@ import org.overture.codegen.runtime.V2J; import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.util.NameGen; public class SeqInfo extends AbstractTypeInfo { public static final String GET_METHOD = "get"; - public static final String ITE_VAR_NAME = "i"; + public static final String ITE_VAR_NAME_PREFIX = "i"; public static final String SIZE__METHOD = "size"; public static final String IS_SEQ_METHOD = "isSeq"; @@ -34,18 +35,19 @@ public List getLeafTypesRecursively() } @Override - public String consCheckExp(String enclosingClass, String javaRootPackage, String arg) + public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) { String isSeqCheck = consSubjectCheck(V2J.class.getSimpleName(), IS_SEQ_METHOD, arg); String sizeCall = consSubjectCheck(V2J.class.getSimpleName(), SIZE__METHOD, arg); - String elemtnArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_METHOD, arg, ITE_VAR_NAME); - String elemtCheck = elementType.consCheckExp(enclosingClass, javaRootPackage, elemtnArg); + String iteVar = nameGen.getName(ITE_VAR_NAME_PREFIX); + String elemtnArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_METHOD, arg, iteVar); + String elemtCheck = elementType.consCheckExp(enclosingClass, javaRootPackage, elemtnArg, nameGen); StringBuilder sb = new StringBuilder(); sb.append(isSeqCheck); sb.append(JmlGenerator.JML_AND); sb.append('('); - sb.append("\\forall int i; 0 <= i && i < "); + sb.append(String.format("\\forall int %1$s; 0 <= %1$s && %1$s < ", iteVar)); sb.append(sizeCall); sb.append("; "); sb.append(elemtCheck); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java index eda2b35ac5..99c9a5888d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java @@ -5,6 +5,7 @@ import org.overture.codegen.runtime.V2J; import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.util.NameGen; public class TupleInfo extends AbstractTypeInfo { @@ -57,7 +58,7 @@ public List getLeafTypesRecursively() } @Override - public String consCheckExp(String enclosingClass, String javaRootPackage, String arg) + public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) { StringBuilder sb = new StringBuilder(); @@ -70,7 +71,7 @@ public String consCheckExp(String enclosingClass, String javaRootPackage, String String fieldArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_FIELD_METHOD_NAME, arg, i + ""); //e.g. Utils.is_nat1(V2J.field(t,2)) - String fieldCheck = types.get(i).consCheckExp(enclosingClass, javaRootPackage, fieldArg); + String fieldCheck = types.get(i).consCheckExp(enclosingClass, javaRootPackage, fieldArg, nameGen); sb.append(JmlGenerator.JML_AND); sb.append(fieldCheck); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java index cb3bb4995f..40616f7f3d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java @@ -4,6 +4,7 @@ import java.util.List; import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.util.NameGen; public class UnionInfo extends AbstractTypeInfo { @@ -53,7 +54,7 @@ public List getLeafTypesRecursively() } @Override - public String consCheckExp(String enclosingModule, String javaRootPackage, String arg) + public String consCheckExp(String enclosingModule, String javaRootPackage, String arg, NameGen nameGen) { StringBuilder sb = new StringBuilder(); @@ -69,7 +70,7 @@ public String consCheckExp(String enclosingModule, String javaRootPackage, Strin for (AbstractTypeInfo currentType : types) { sb.append(orSep); - sb.append(currentType.consCheckExp(enclosingModule, javaRootPackage, arg)); + sb.append(currentType.consCheckExp(enclosingModule, javaRootPackage, arg, nameGen)); orSep = JmlGenerator.JML_OR; } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/NameGen.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/NameGen.java index 6123d7d26d..5c8f7739b2 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/NameGen.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/util/NameGen.java @@ -14,10 +14,15 @@ public class NameGen { private Set toAvoid; - - public NameGen(ADefaultClassDeclCG classDecl) + + public NameGen() { this.toAvoid = new HashSet(); + } + + public NameGen(ADefaultClassDeclCG classDecl) + { + this(); for (AFieldDeclCG field : classDecl.getFields()) { From 515611cfd00226a0ea0ac17cfe6f8128d053a037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 00:31:07 +0200 Subject: [PATCH 152/706] Force type info classes to take all data upon construction --- .../codegen/vdm2jml/predgen/TypePredUtil.java | 96 +++++++++++-------- .../info/NamedTypeInvDepCalculator.java | 12 +-- .../vdm2jml/predgen/info/TupleInfo.java | 9 +- .../vdm2jml/predgen/info/UnionInfo.java | 9 +- 4 files changed, 66 insertions(+), 60 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index 7b075dca64..54e0d4831d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -4,6 +4,7 @@ import java.util.List; import org.overture.ast.util.ClonableString; +import org.overture.codegen.assistant.TypeAssistantCG; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.declarations.ANamedTypeDeclCG; @@ -228,56 +229,71 @@ public AbstractTypeInfo findTypeInfo(STypeCG type) return info; // We do not need to collect sub named invariant types - } else if (type instanceof AUnionTypeCG) + } else { - UnionInfo unionInfo = new UnionInfo(handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type)); - - for (STypeCG t : ((AUnionTypeCG) type).getTypes()) + TypeAssistantCG assist = handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant(); + + if (type instanceof AUnionTypeCG) { - unionInfo.getTypes().add(findTypeInfo(t)); + List types = new LinkedList<>(); + + for (STypeCG t : ((AUnionTypeCG) type).getTypes()) + { + AbstractTypeInfo tInfo = findTypeInfo(t); + + if(tInfo != null) + { + types.add(tInfo); + } + } + + return new UnionInfo(assist.allowsNull(type), types); } - - return unionInfo; - } - else if(type instanceof ATupleTypeCG) - { - TupleInfo tupleInfo = new TupleInfo(handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type)); - - for(STypeCG t : ((ATupleTypeCG) type).getTypes()) + else if(type instanceof ATupleTypeCG) { - tupleInfo.getTypes().add(findTypeInfo(t)); + List types = new LinkedList<>(); + + for(STypeCG t : ((ATupleTypeCG) type).getTypes()) + { + AbstractTypeInfo tInfo = findTypeInfo(t); + + if(tInfo != null) + { + types.add(tInfo); + } + } + + return new TupleInfo(assist.allowsNull(type), types); } - - return tupleInfo; - } - else if(type instanceof AUnknownTypeCG) - { - return null; - } - else if(type instanceof ASeqSeqTypeCG) - { - STypeCG t = ((ASeqSeqTypeCG) type).getSeqOf(); - - AbstractTypeInfo elementInfo = findTypeInfo(t); - - if(elementInfo != null) + else if(type instanceof AUnknownTypeCG) { - return new SeqInfo(handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type), elementInfo); + return null; } - else + else if(type instanceof ASeqSeqTypeCG) + { + STypeCG t = ((ASeqSeqTypeCG) type).getSeqOf(); + + AbstractTypeInfo elementInfo = findTypeInfo(t); + + if(elementInfo != null) + { + return new SeqInfo(assist.allowsNull(type), elementInfo); + } + else + { + return null; + } + } + else if(type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG) { + // Can't do anything for these right now... + // TODO: implement handling return null; } - } - else if(type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG || type instanceof ATupleTypeCG) - { - // Can't do anything for these right now... - // TODO: implement handling - return null; - } - else - { - return new LeafTypeInfo(type, handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant().allowsNull(type)); + else + { + return new LeafTypeInfo(type, assist.allowsNull(type)); + } } } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index 8b999be632..4b512f3a07 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -123,7 +123,7 @@ private static AbstractTypeInfo create(IRInfo info, PType type, Set visit } else if (type instanceof AUnionType) { - UnionInfo unionInfo = new UnionInfo(optional); + List types = new LinkedList<>(); for (PType t : ((AUnionType) type).getTypes()) { @@ -131,15 +131,15 @@ private static AbstractTypeInfo create(IRInfo info, PType type, Set visit if(tInfo != null) { - unionInfo.getTypes().add(tInfo); + types.add(tInfo); } } - return unionInfo; + return new UnionInfo(optional, types); } else if(type instanceof AProductType) { - TupleInfo tupleInfo = new TupleInfo(optional); + List types = new LinkedList<>(); for(PType t : ((AProductType) type).getTypes()) { @@ -147,11 +147,11 @@ private static AbstractTypeInfo create(IRInfo info, PType type, Set visit if(tInfo != null) { - tupleInfo.getTypes().add(tInfo); + types.add(tInfo); } } - return tupleInfo; + return new TupleInfo(optional, types); } else if(type instanceof SSeqType) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java index 99c9a5888d..5dfafab9a5 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java @@ -14,17 +14,12 @@ public class TupleInfo extends AbstractTypeInfo private List types; - public TupleInfo(boolean optional) + public TupleInfo(boolean optional, List types) { super(optional); - this.types = new LinkedList<>(); + this.types = types; } - public List getTypes() - { - return types; - } - @Override public boolean allowsNull() { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java index 40616f7f3d..0dea336025 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnionInfo.java @@ -10,15 +10,10 @@ public class UnionInfo extends AbstractTypeInfo { private List types; - public UnionInfo(boolean optional) + public UnionInfo(boolean optional, List types) { super(optional); - this.types = new LinkedList<>(); - } - - public List getTypes() - { - return types; + this.types = types; } @Override From 053746783bd842a3bfc4fc53d406488e0d22bb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 00:48:04 +0200 Subject: [PATCH 153/706] Add test to check compatibility of runtime methods --- .../overture/vdm2jml/tests/V2JCallTests.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java new file mode 100644 index 0000000000..076aa80dc5 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java @@ -0,0 +1,59 @@ +package org.overture.vdm2jml.tests; + +import java.lang.reflect.Method; +import java.util.Arrays; + +import org.junit.Assert; +import org.junit.Test; +import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; +import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; + +public class V2JCallTests +{ + @Test + public void checkIsTup() + { + assertMethod(TupleInfo.IS_TUP_METHOD_NAME, Object.class); + } + + @Test + public void checkTupField() + { + assertMethod(TupleInfo.GET_FIELD_METHOD_NAME, Object.class, int.class); + } + + @Test + public void checkGetSeqElement() + { + assertMethod(SeqInfo.GET_METHOD, Object.class, int.class); + } + + @Test + public void checkSeqSize() + { + assertMethod(SeqInfo.SIZE__METHOD, Object.class); + } + + @Test + public void checkIsSeq() + { + assertMethod(SeqInfo.IS_SEQ_METHOD, Object.class); + } + + public void assertMethod(String methodName, Class... paramTypes) + { + Method method = null; + + try + { + method = V2J.class.getMethod(methodName, paramTypes); + } catch (NoSuchMethodException | SecurityException e) + { + // Do nothing + } + + Assert.assertNotNull("Could not find method '" + methodName + "' in V2J with arguments " + + Arrays.toString(paramTypes), method); + } +} From 8b144f650bb7b1000ca1a58ebbf55da2ca1da195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 09:25:45 +0200 Subject: [PATCH 154/706] Fix to handling of tuple types: the size of the tuple was not taken into account --- .../org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java index 5dfafab9a5..219dd5c03e 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java @@ -56,9 +56,10 @@ public List getLeafTypesRecursively() public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) { StringBuilder sb = new StringBuilder(); + int tupleSize = types.size(); //e.g. V2J.isTup(t) - sb.append(consSubjectCheck(V2J.class.getSimpleName(), IS_TUP_METHOD_NAME, arg)); + sb.append(consSubjectCheckExtraArg(V2J.class.getSimpleName(), IS_TUP_METHOD_NAME, arg, tupleSize + "")); for(int i = 0; i < types.size(); i++) { From dd22f654b7e7df66d476901ce1bfff5f46dccd9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 09:26:22 +0200 Subject: [PATCH 155/706] Updates to test results related to checking of tuple types --- .../tupletype/NatBoolBasedNamedTypeInv/Entry.java | 6 +++--- .../NatBooolBasedNamedTypeInv.vdmsl.result | 4 ++-- .../dynamic_analysis/tupletype/NatBoolNegField/Entry.java | 4 ++-- .../NatBoolNegField/NatBoolNegField.vdmsl.result | 2 +- .../dynamic_analysis/tupletype/NatBoolTupNil/Entry.java | 8 ++++---- .../tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java index 99eca11d3e..169b79a22a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Tuple ignorePattern_1 = Tuple.mk_(1001L, true); - //@ assert ((V2J.isTup(ignorePattern_1) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))) && inv_Entry_TrueEven(ignorePattern_1)); + //@ assert ((V2J.isTup(ignorePattern_1,2) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))) && inv_Entry_TrueEven(ignorePattern_1)); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Tuple ignorePattern_2 = Tuple.mk_(1000L, true); - //@ assert ((V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))) && inv_Entry_TrueEven(ignorePattern_2)); + //@ assert ((V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))) && inv_Entry_TrueEven(ignorePattern_2)); /* skip */ } @@ -37,7 +37,7 @@ public static Object Run() { { Tuple ignorePattern_3 = Tuple.mk_(1001L, false); - //@ assert ((V2J.isTup(ignorePattern_3) && Utils.is_nat(V2J.field(ignorePattern_3,0)) && Utils.is_bool(V2J.field(ignorePattern_3,1))) && inv_Entry_TrueEven(ignorePattern_3)); + //@ assert ((V2J.isTup(ignorePattern_3,2) && Utils.is_nat(V2J.field(ignorePattern_3,0)) && Utils.is_bool(V2J.field(ignorePattern_3,1))) && inv_Entry_TrueEven(ignorePattern_3)); /* skip */ } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result index 769efe73e9..c6b370e30b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result @@ -2,9 +2,9 @@ "After legal use" "Before illegal uses" Entry.java:32: JML assertion is false - //@ assert ((V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))) && inv_Entry_TrueEven(ignorePattern_2)); + //@ assert ((V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))) && inv_Entry_TrueEven(ignorePattern_2)); ^ Entry.java:40: JML assertion is false - //@ assert ((V2J.isTup(ignorePattern_3) && Utils.is_nat(V2J.field(ignorePattern_3,0)) && Utils.is_bool(V2J.field(ignorePattern_3,1))) && inv_Entry_TrueEven(ignorePattern_3)); + //@ assert ((V2J.isTup(ignorePattern_3,2) && Utils.is_nat(V2J.field(ignorePattern_3,0)) && Utils.is_bool(V2J.field(ignorePattern_3,1))) && inv_Entry_TrueEven(ignorePattern_3)); ^ "After illegal uses" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java index 2d83de3bf4..e24df812e2 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Tuple ignorePattern_1 = Tuple.mk_(1L, true); - //@ assert (V2J.isTup(ignorePattern_1) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))); + //@ assert (V2J.isTup(ignorePattern_1,2) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Tuple ignorePattern_2 = Tuple.mk_(negInt(), true); - //@ assert (V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); + //@ assert (V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); /* skip */ } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result index b0cedee202..a1004bc8a6 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result @@ -2,6 +2,6 @@ "After legal use" "Before illegal use" Entry.java:32: JML assertion is false - //@ assert (V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); + //@ assert (V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java index 88c8c37f47..fd8ef2e59e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java @@ -18,7 +18,7 @@ public static Object Run() { { Tuple ignorePattern_1 = Tuple.mk_(1L, true); - //@ assert (V2J.isTup(ignorePattern_1) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))); + //@ assert (V2J.isTup(ignorePattern_1,2) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_bool(V2J.field(ignorePattern_1,1))); /* skip */ } @@ -29,7 +29,7 @@ public static Object Run() { { Tuple ignorePattern_2 = TupNil(); - //@ assert (V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); + //@ assert (V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); /* skip */ } @@ -43,7 +43,7 @@ public static Object Run() { public static Tuple TupNil() { Tuple ret_1 = null; - //@ assert ((ret_1 == null) || (V2J.isTup(ret_1) && Utils.is_nat1(V2J.field(ret_1,0)) && Utils.is_bool(V2J.field(ret_1,1)))); + //@ assert ((ret_1 == null) || (V2J.isTup(ret_1,2) && Utils.is_nat1(V2J.field(ret_1,0)) && Utils.is_bool(V2J.field(ret_1,1)))); return Utils.copy(ret_1); } @@ -51,7 +51,7 @@ public static Tuple TupNil() { public static Tuple TupVal() { Tuple ret_2 = Tuple.mk_(1L, false); - //@ assert ((ret_2 == null) || (V2J.isTup(ret_2) && Utils.is_nat1(V2J.field(ret_2,0)) && Utils.is_bool(V2J.field(ret_2,1)))); + //@ assert ((ret_2 == null) || (V2J.isTup(ret_2,2) && Utils.is_nat1(V2J.field(ret_2,0)) && Utils.is_bool(V2J.field(ret_2,1)))); return Utils.copy(ret_2); } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result index b0cedee202..a1004bc8a6 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result @@ -2,6 +2,6 @@ "After legal use" "Before illegal use" Entry.java:32: JML assertion is false - //@ assert (V2J.isTup(ignorePattern_2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); + //@ assert (V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); ^ "After illegal use" \ No newline at end of file From 3f009e4f7889e1fd8873904262f147350eb79928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 10:02:19 +0200 Subject: [PATCH 156/706] Update type info hierarchy to represent types that are not checked yet --- .../vdm2jml/predgen/TypePredHandler.java | 22 +++++++----- .../codegen/vdm2jml/predgen/TypePredUtil.java | 34 ++++--------------- .../info/NamedTypeInvDepCalculator.java | 7 ++++ .../vdm2jml/predgen/info/UnknownLeaf.java | 32 +++++++++++++++++ 4 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnknownLeaf.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java index 3184fd32b7..4c5aea7bba 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java @@ -29,6 +29,7 @@ import org.overture.codegen.vdm2jml.JmlAnnotationHelper; import org.overture.codegen.vdm2jml.JmlGenerator; import org.overture.codegen.vdm2jml.predgen.info.AbstractTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.UnknownLeaf; import org.overture.codegen.vdm2jml.util.IsValChecker; public class TypePredHandler @@ -87,7 +88,7 @@ public void handleField(AFieldDeclCG node) AbstractTypeInfo typeInfo = util.findTypeInfo(node.getType()); - if (typeInfo != null) + if (proceed(typeInfo)) { AIdentifierVarExpCG var = getJmlGen().getJavaGen().getInfo().getExpAssistant().consIdVar(node.getName(), node.getType().clone()); @@ -172,7 +173,7 @@ public void handleReturn(AReturnStmCG node) throws AnalysisException AbstractTypeInfo typeInfo = util.findTypeInfo(returnType); - if (typeInfo == null) + if (!proceed(typeInfo)) { return; } @@ -207,7 +208,7 @@ public void handleMethod(AMethodDeclCG node) throws AnalysisException { AbstractTypeInfo typeInfo = util.findTypeInfo(param.getType()); - if (typeInfo != null) + if (proceed(typeInfo)) { ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); @@ -277,7 +278,7 @@ public List handleMapSeq(AMapSeqUpdateStmCG node) AbstractTypeInfo typeInfo = util.findTypeInfo(var.getType()); - if (typeInfo != null) + if (proceed(typeInfo)) { ADefaultClassDeclCG enclosingClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); @@ -306,7 +307,7 @@ public List handleVarDecl(AVarDeclCG node) AbstractTypeInfo typeInfo = util.findTypeInfo(node.getType()); - if (typeInfo != null) + if (proceed(typeInfo)) { String name = decorator.getJmlGen().getUtil().getName(node.getPattern()); @@ -364,7 +365,7 @@ public List handleCallObj(ACallObjectExpStmCG node) AbstractTypeInfo typeInfo = util.findTypeInfo(recObj.getType()); - if (typeInfo != null) + if (proceed(typeInfo)) { ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); @@ -413,7 +414,7 @@ public void handleAssign(AAssignToExpStmCG node) AbstractTypeInfo typeInfo = util.findTypeInfo(node.getTarget().getType()); - if (typeInfo != null) + if (proceed(typeInfo)) { ADefaultClassDeclCG encClass = decorator.getJmlGen().getUtil().getEnclosingClass(node); @@ -490,7 +491,7 @@ public List consAsserts(AIdentifierVarExpCG var) { AbstractTypeInfo typeInfo = util.findTypeInfo(var.getType()); - if (typeInfo == null) + if (!proceed(typeInfo)) { return null; } @@ -572,4 +573,9 @@ private void addAssert(AAssignToExpStmCG node, AMetaStmCG assertStm) replStm.getStatements().add(node); replStm.getStatements().add(assertStm); } + + private boolean proceed(AbstractTypeInfo typeInfo) + { + return !(typeInfo instanceof UnknownLeaf); + } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index 54e0d4831d..f060215e5b 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -28,6 +28,7 @@ import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; import org.overture.codegen.vdm2jml.predgen.info.UnionInfo; +import org.overture.codegen.vdm2jml.predgen.info.UnknownLeaf; import org.overture.codegen.vdm2jml.util.NameGen; public class TypePredUtil @@ -239,12 +240,7 @@ public AbstractTypeInfo findTypeInfo(STypeCG type) for (STypeCG t : ((AUnionTypeCG) type).getTypes()) { - AbstractTypeInfo tInfo = findTypeInfo(t); - - if(tInfo != null) - { - types.add(tInfo); - } + types.add(findTypeInfo(t)); } return new UnionInfo(assist.allowsNull(type), types); @@ -255,40 +251,22 @@ else if(type instanceof ATupleTypeCG) for(STypeCG t : ((ATupleTypeCG) type).getTypes()) { - AbstractTypeInfo tInfo = findTypeInfo(t); - - if(tInfo != null) - { - types.add(tInfo); - } + types.add(findTypeInfo(t)); } return new TupleInfo(assist.allowsNull(type), types); } - else if(type instanceof AUnknownTypeCG) - { - return null; - } else if(type instanceof ASeqSeqTypeCG) { STypeCG t = ((ASeqSeqTypeCG) type).getSeqOf(); - AbstractTypeInfo elementInfo = findTypeInfo(t); - - if(elementInfo != null) - { - return new SeqInfo(assist.allowsNull(type), elementInfo); - } - else - { - return null; - } + return new SeqInfo(assist.allowsNull(type), findTypeInfo(t)); } - else if(type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG) + else if(type instanceof AUnknownTypeCG || type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG) { // Can't do anything for these right now... // TODO: implement handling - return null; + return new UnknownLeaf(); } else { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index 4b512f3a07..435a20677a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -8,10 +8,13 @@ import org.overture.ast.analysis.AnalysisException; import org.overture.ast.analysis.DepthFirstAnalysisAdaptor; import org.overture.ast.types.ABracketType; +import org.overture.ast.types.AMapMapType; import org.overture.ast.types.ANamedInvariantType; import org.overture.ast.types.AOptionalType; import org.overture.ast.types.AProductType; +import org.overture.ast.types.ASetType; import org.overture.ast.types.AUnionType; +import org.overture.ast.types.AUnknownType; import org.overture.ast.types.PType; import org.overture.ast.types.SSeqType; import org.overture.codegen.cgast.STypeCG; @@ -159,6 +162,10 @@ else if(type instanceof SSeqType) return new SeqInfo(optional, create(info, seqType.getSeqof(), visited)); } + else if(type instanceof AUnknownType || type instanceof ASetType || type instanceof AMapMapType) + { + return new UnknownLeaf(); + } else { return new LeafTypeInfo(toIrType(type, info), optional); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnknownLeaf.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnknownLeaf.java new file mode 100644 index 0000000000..c4b02f7292 --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/UnknownLeaf.java @@ -0,0 +1,32 @@ +package org.overture.codegen.vdm2jml.predgen.info; + +import java.util.LinkedList; +import java.util.List; + +import org.overture.codegen.vdm2jml.util.NameGen; + +public class UnknownLeaf extends AbstractTypeInfo +{ + public UnknownLeaf() + { + super(false); + } + + @Override + public boolean allowsNull() + { + return false; + } + + @Override + public List getLeafTypesRecursively() + { + return new LinkedList<>(); + } + + @Override + public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) + { + return "true"; + } +} From c30d72981324179827d9e333b8fa3c6ad5fa7685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 10:03:35 +0200 Subject: [PATCH 157/706] Expect 'isTup' check to include the size of the tuple --- .../src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java index 076aa80dc5..c3c1250463 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java @@ -14,7 +14,7 @@ public class V2JCallTests @Test public void checkIsTup() { - assertMethod(TupleInfo.IS_TUP_METHOD_NAME, Object.class); + assertMethod(TupleInfo.IS_TUP_METHOD_NAME, Object.class, int.class); } @Test From 089d7c5ebdec6d42b7da62438f76f9305f775e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 10:23:58 +0200 Subject: [PATCH 158/706] Add test exercising checking of tuple types of different size --- .../tupletype/TupleSizeMismatch/Entry.java | 61 +++++++++++++++++++ .../TupleSizeMismatch/TupleSizeMismatch.vdmsl | 29 +++++++++ .../TupleSizeMismatch.vdmsl.result | 7 +++ 3 files changed, 97 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java new file mode 100644 index 0000000000..99be9e7c98 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java @@ -0,0 +1,61 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + Tuple ignorePattern_1 = ((Tuple) Tup4()); + + //@ assert (V2J.isTup(ignorePattern_1,4) && Utils.is_nat(V2J.field(ignorePattern_1,0)) && Utils.is_nat(V2J.field(ignorePattern_1,1)) && Utils.is_char(V2J.field(ignorePattern_1,2)) && Utils.is_bool(V2J.field(ignorePattern_1,3))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + Tuple ignorePattern_2 = ((Tuple) Tup3()); + + //@ assert (V2J.isTup(ignorePattern_2,4) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_nat(V2J.field(ignorePattern_2,1)) && Utils.is_char(V2J.field(ignorePattern_2,2)) && Utils.is_bool(V2J.field(ignorePattern_2,3))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static Object Tup3() { + Object ret_1 = Tuple.mk_(1L, 'a', true); + + //@ assert ((V2J.isTup(ret_1,3) && Utils.is_nat(V2J.field(ret_1,0)) && Utils.is_char(V2J.field(ret_1,1)) && Utils.is_bool(V2J.field(ret_1,2))) || (V2J.isTup(ret_1,4) && Utils.is_nat(V2J.field(ret_1,0)) && Utils.is_nat(V2J.field(ret_1,1)) && Utils.is_char(V2J.field(ret_1,2)) && Utils.is_bool(V2J.field(ret_1,3)))); + return ret_1; + } + + /*@ pure @*/ + public static Object Tup4() { + Object ret_2 = Tuple.mk_(1L, 2L, 'b', false); + + //@ assert ((V2J.isTup(ret_2,3) && Utils.is_nat(V2J.field(ret_2,0)) && Utils.is_char(V2J.field(ret_2,1)) && Utils.is_bool(V2J.field(ret_2,2))) || (V2J.isTup(ret_2,4) && Utils.is_nat(V2J.field(ret_2,0)) && Utils.is_nat(V2J.field(ret_2,1)) && Utils.is_char(V2J.field(ret_2,2)) && Utils.is_bool(V2J.field(ret_2,3)))); + return ret_2; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl new file mode 100644 index 0000000000..a63b0be4f6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl @@ -0,0 +1,29 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : nat * nat * char * bool = Tup4() in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : nat * nat * char * bool = Tup3() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +Tup3 : () -> (nat * char * bool) | (nat * nat * char * bool) +Tup3 () == mk_(1,'a',true); + +Tup4 : () -> (nat * char * bool) | (nat * nat * char * bool) +Tup4 () == mk_(1,2,'b',false); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl.result new file mode 100644 index 0000000000..e47fcc5eca --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:32: JML assertion is false + //@ assert (V2J.isTup(ignorePattern_2,4) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_nat(V2J.field(ignorePattern_2,1)) && Utils.is_char(V2J.field(ignorePattern_2,2)) && Utils.is_bool(V2J.field(ignorePattern_2,3))); + ^ +"After illegal use" \ No newline at end of file From b0765ec0f48505a72599739433d8463176989988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 11:01:01 +0200 Subject: [PATCH 159/706] Add tests to exercise handling of sequence types --- .../seqtype/SeqEven/Entry.java | 67 +++++++++++++++++++ .../seqtype/SeqEven/SeqEven.vdmsl | 29 ++++++++ .../seqtype/SeqEven/SeqEven.vdmsl.result | 7 ++ .../Entry.java | 59 ++++++++++++++++ .../SeqNat1BoolMaskedAsNamedTypeInv.vdmsl | 30 +++++++++ ...qNat1BoolMaskedAsNamedTypeInv.vdmsl.result | 7 ++ 6 files changed, 199 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java new file mode 100644 index 0000000000..278ddfe049 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java @@ -0,0 +1,67 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMSeq ignorePattern_1 = SeqUtil.seq(); + + //@ assert ((V2J.isSeq(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); (Utils.is_nat(V2J.get(ignorePattern_1,i)) && inv_Entry_Even(V2J.get(ignorePattern_1,i))))) && inv_Entry_SeqEven(ignorePattern_1)); + + /* skip */ + } + + { + VDMSeq ignorePattern_2 = SeqUtil.seq(2L, 4L, 6L, 8L); + + //@ assert ((V2J.isSeq(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); (Utils.is_nat(V2J.get(ignorePattern_2,i)) && inv_Entry_Even(V2J.get(ignorePattern_2,i))))) && inv_Entry_SeqEven(ignorePattern_2)); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMSeq ignorePattern_3 = SeqUtil.seq(2L, 4L, 6L, 8L, 9L); + + //@ assert ((V2J.isSeq(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); (Utils.is_nat(V2J.get(ignorePattern_3,i)) && inv_Entry_Even(V2J.get(ignorePattern_3,i))))) && inv_Entry_SeqEven(ignorePattern_3)); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + public String toString() { + return "Entry{}"; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_SeqEven(final Object check_elem) { + return true; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_Even(final Object check_e) { + Number e = ((Number) check_e); + + return Utils.equals(Utils.mod(e.longValue(), 2L), 0L); + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl new file mode 100644 index 0000000000..27186a0744 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl @@ -0,0 +1,29 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +SeqEven = seq of Even; + +Even = nat +inv e == e mod 2 = 0; + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : SeqEven = [] in skip; + let - : SeqEven = [2,4,6,8] in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : SeqEven = [2,4,6,8,9] in skip; + IO`println("After illegal use"); + return 0; +); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl.result new file mode 100644 index 0000000000..3543746b17 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:40: JML assertion is false + //@ assert ((V2J.isSeq(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); (Utils.is_nat(V2J.get(ignorePattern_3,i)) && inv_Entry_Even(V2J.get(ignorePattern_3,i))))) && inv_Entry_SeqEven(ignorePattern_3)); + ^ +"After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java new file mode 100644 index 0000000000..4b0eccd25b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java @@ -0,0 +1,59 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMSeq ignorePattern_1 = SeqUtil.seq(1L, true, 2L, false, 3L); + + //@ assert ((V2J.isSeq(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); (Utils.is_bool(V2J.get(ignorePattern_1,i)) || Utils.is_nat1(V2J.get(ignorePattern_1,i))))) && inv_Entry_SeqNat1Bool(ignorePattern_1)); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMSeq ignorePattern_2 = SeqUtil.seq(1L, true, 2L, false, minusOne()); + + //@ assert ((V2J.isSeq(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); (Utils.is_bool(V2J.get(ignorePattern_2,i)) || Utils.is_nat1(V2J.get(ignorePattern_2,i))))) && inv_Entry_SeqNat1Bool(ignorePattern_2)); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static Number minusOne() { + Number ret_1 = -1L; + + //@ assert Utils.is_int(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_SeqNat1Bool(final Object check_elem) { + return true; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl new file mode 100644 index 0000000000..b29c274c4b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl @@ -0,0 +1,30 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +SeqNat1Bool = seq of (nat1 | bool); + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : SeqNat1Bool = [1,true,2,false,3] in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : SeqNat1Bool = [1,true,2,false,minusOne()] in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +minusOne : () -> int +minusOne () == -1; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl.result new file mode 100644 index 0000000000..475875325d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:32: JML assertion is false + //@ assert ((V2J.isSeq(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); (Utils.is_bool(V2J.get(ignorePattern_2,i)) || Utils.is_nat1(V2J.get(ignorePattern_2,i))))) && inv_Entry_SeqNat1Bool(ignorePattern_2)); + ^ +"After illegal use" \ No newline at end of file From f114f242a103b0cd3c6368f8a9c1aa960db6424b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 11:37:15 +0200 Subject: [PATCH 160/706] Update IR to support the seq1 type --- core/codegen/ir/src/main/resources/cg.astv2 | 1 + .../java/org/overture/codegen/assistant/TypeAssistantCG.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/codegen/ir/src/main/resources/cg.astv2 b/core/codegen/ir/src/main/resources/cg.astv2 index fc1515861d..8e4784cec0 100644 --- a/core/codegen/ir/src/main/resources/cg.astv2 +++ b/core/codegen/ir/src/main/resources/cg.astv2 @@ -581,6 +581,7 @@ externalType {-> package='org.overture.codegen.cgast.utils'} #seq {-> package='org.overture.codegen.cgast.types' | [empty]:java_Boolean + | [seq1]:java_Boolean | [seqOf]:CG.#type} = {seq} ; diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java index 94f5f761fc..5cfaac8667 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/TypeAssistantCG.java @@ -36,6 +36,7 @@ import org.overture.ast.types.ANamedInvariantType; import org.overture.ast.types.AOptionalType; import org.overture.ast.types.AProductType; +import org.overture.ast.types.ASeq1SeqType; import org.overture.ast.types.AUnionType; import org.overture.ast.types.PType; import org.overture.ast.types.SSeqTypeBase; @@ -303,6 +304,8 @@ public STypeCG constructSeqType(SSeqTypeBase node, IRInfo question) { STypeCG seqOfCg = node.getSeqof().apply(question.getTypeVisitor(), question); boolean emptyCg = node.getEmpty(); + + boolean isSeq1 = node instanceof ASeq1SeqType; // This is a special case since sequence of characters are strings if (seqOfCg instanceof ACharBasicTypeCG @@ -317,6 +320,7 @@ public STypeCG constructSeqType(SSeqTypeBase node, IRInfo question) ASeqSeqTypeCG seqType = new ASeqSeqTypeCG(); seqType.setSeqOf(seqOfCg); seqType.setEmpty(emptyCg); + seqType.setSeq1(isSeq1); return seqType; } From c44c1f2c158f120c1e98748db75d9a2c784d4bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 11:38:59 +0200 Subject: [PATCH 161/706] Add support for checking of seq1 --- .../overture/codegen/vdm2jml/predgen/TypePredUtil.java | 6 ++++-- .../vdm2jml/predgen/info/NamedTypeInvDepCalculator.java | 9 ++++++--- .../overture/codegen/vdm2jml/predgen/info/SeqInfo.java | 8 +++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index f060215e5b..58a69216da 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -3,6 +3,7 @@ import java.util.LinkedList; import java.util.List; +import org.apache.commons.lang.BooleanUtils; import org.overture.ast.util.ClonableString; import org.overture.codegen.assistant.TypeAssistantCG; import org.overture.codegen.cgast.INode; @@ -258,9 +259,10 @@ else if(type instanceof ATupleTypeCG) } else if(type instanceof ASeqSeqTypeCG) { - STypeCG t = ((ASeqSeqTypeCG) type).getSeqOf(); + ASeqSeqTypeCG seqType = ((ASeqSeqTypeCG) type); + STypeCG t = seqType.getSeqOf(); - return new SeqInfo(assist.allowsNull(type), findTypeInfo(t)); + return new SeqInfo(assist.allowsNull(type), findTypeInfo(t), BooleanUtils.isTrue(seqType.getSeq1())); } else if(type instanceof AUnknownTypeCG || type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index 435a20677a..c3d112be54 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -12,11 +12,13 @@ import org.overture.ast.types.ANamedInvariantType; import org.overture.ast.types.AOptionalType; import org.overture.ast.types.AProductType; +import org.overture.ast.types.ASeq1SeqType; import org.overture.ast.types.ASetType; import org.overture.ast.types.AUnionType; import org.overture.ast.types.AUnknownType; import org.overture.ast.types.PType; import org.overture.ast.types.SSeqType; +import org.overture.ast.types.SSeqTypeBase; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.ir.IRInfo; import org.overture.codegen.logging.Logger; @@ -156,11 +158,12 @@ private static AbstractTypeInfo create(IRInfo info, PType type, Set visit return new TupleInfo(optional, types); } - else if(type instanceof SSeqType) + else if(type instanceof SSeqTypeBase) { SSeqType seqType = (SSeqType) type; - - return new SeqInfo(optional, create(info, seqType.getSeqof(), visited)); + boolean isSeq1 = seqType instanceof ASeq1SeqType; + + return new SeqInfo(optional, create(info, seqType.getSeqof(), visited), isSeq1); } else if(type instanceof AUnknownType || type instanceof ASetType || type instanceof AMapMapType) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java index eac4bbd0d2..ee778fe667 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java @@ -13,13 +13,16 @@ public class SeqInfo extends AbstractTypeInfo public static final String ITE_VAR_NAME_PREFIX = "i"; public static final String SIZE__METHOD = "size"; public static final String IS_SEQ_METHOD = "isSeq"; + public static final String IS_SEQ1_METHOD = "isSeq1"; private AbstractTypeInfo elementType; + private boolean isSeq1; - public SeqInfo(boolean optional, AbstractTypeInfo elementType) + public SeqInfo(boolean optional, AbstractTypeInfo elementType, boolean isSeq1) { super(optional); this.elementType = elementType; + this.isSeq1 = isSeq1; } @Override @@ -37,7 +40,7 @@ public List getLeafTypesRecursively() @Override public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) { - String isSeqCheck = consSubjectCheck(V2J.class.getSimpleName(), IS_SEQ_METHOD, arg); + String isSeqCheck = consSubjectCheck(V2J.class.getSimpleName(), isSeq1 ? IS_SEQ1_METHOD : IS_SEQ_METHOD, arg); String sizeCall = consSubjectCheck(V2J.class.getSimpleName(), SIZE__METHOD, arg); String iteVar = nameGen.getName(ITE_VAR_NAME_PREFIX); String elemtnArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_METHOD, arg, iteVar); @@ -65,5 +68,4 @@ public String consCheckExp(String enclosingClass, String javaRootPackage, String return seqCheckExp; } } - } From f193d8f9d7d2210d26393906bf5fd42bdab281b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 11:40:00 +0200 Subject: [PATCH 162/706] Prepare testing of JML generation of seq1 --- .../tests/exec/JmlSeq1TypeExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeq1TypeExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeq1TypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeq1TypeExecTests.java new file mode 100644 index 0000000000..77b48b13a5 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeq1TypeExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlSeq1TypeExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "seq1type"; + + public static final String PROPERTY_ID = "seq1type"; + + public JmlSeq1TypeExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From e6722fd023f3b84fa4f827277843a65358cbd048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 11:46:00 +0200 Subject: [PATCH 163/706] Add tests to exercise handling of seq1 --- .../overture/vdm2jml/tests/V2JCallTests.java | 6 ++ .../seq1type/Seq1AssignEmptySet/Entry.java | 53 +++++++++++++ .../Seq1AssignEmptySet.vdmsl | 26 +++++++ .../Seq1AssignEmptySet.vdmsl.result | 7 ++ .../Entry.java | 78 +++++++++++++++++++ .../Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl | 32 ++++++++ ...1EvenNatsMaskedAsNamedTypeInv.vdmsl.result | 10 +++ 7 files changed, 212 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java index c3c1250463..5fac562ffd 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java @@ -41,6 +41,12 @@ public void checkIsSeq() assertMethod(SeqInfo.IS_SEQ_METHOD, Object.class); } + @Test + public void checkIsSeq1() + { + assertMethod(SeqInfo.IS_SEQ1_METHOD, Object.class); + } + public void assertMethod(String methodName, Class... paramTypes) { Method method = null; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Entry.java new file mode 100644 index 0000000000..d2aa4c8409 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Entry.java @@ -0,0 +1,53 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMSeq ignorePattern_1 = SeqUtil.seq(1L); + + //@ assert (V2J.isSeq1(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat(V2J.get(ignorePattern_1,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMSeq ignorePattern_2 = emptySeqOfNat(); + + //@ assert (V2J.isSeq1(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static VDMSeq emptySeqOfNat() { + VDMSeq ret_1 = SeqUtil.seq(); + + //@ assert (V2J.isSeq(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.get(ret_1,i)))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl new file mode 100644 index 0000000000..036a545608 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl @@ -0,0 +1,26 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : seq1 of nat = [1] in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : seq1 of nat = emptySeqOfNat() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +emptySeqOfNat : () -> seq of nat +emptySeqOfNat () == []; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result new file mode 100644 index 0000000000..837082952b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:32: JML assertion is false + //@ assert (V2J.isSeq1(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); + ^ +"After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java new file mode 100644 index 0000000000..29a7b7318b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java @@ -0,0 +1,78 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMSeq ignorePattern_1 = SeqUtil.seq(2L, 4L, 6L); + + //@ assert ((V2J.isSeq1(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat(V2J.get(ignorePattern_1,i)))) && inv_Entry_Seq1Even(ignorePattern_1)); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMSeq ignorePattern_2 = SeqUtil.seq(2L, 4L, 6L, 9L); + + //@ assert ((V2J.isSeq1(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))) && inv_Entry_Seq1Even(ignorePattern_2)); + + /* skip */ + } + + { + VDMSeq ignorePattern_3 = emptySeqOfNat(); + + //@ assert ((V2J.isSeq1(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.get(ignorePattern_3,i)))) && inv_Entry_Seq1Even(ignorePattern_3)); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static VDMSeq emptySeqOfNat() { + VDMSeq ret_1 = SeqUtil.seq(); + + //@ assert (V2J.isSeq(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.get(ret_1,i)))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_Seq1Even(final Object check_xs) { + VDMSeq xs = ((VDMSeq) check_xs); + + Boolean forAllExpResult_1 = true; + VDMSet set_1 = SeqUtil.elems(Utils.copy(xs)); + + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && forAllExpResult_1;) { + Number x = ((Number) iterator_1.next()); + forAllExpResult_1 = Utils.equals(Utils.mod(x.longValue(), 2L), 0L); + } + + return forAllExpResult_1; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl new file mode 100644 index 0000000000..829b915a5f --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl @@ -0,0 +1,32 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +Seq1Even = seq1 of nat +inv xs == forall x in set elems xs & x mod 2 = 0; + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : Seq1Even = [2,4,6] in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : Seq1Even = [2,4,6,9] in skip; + let - : Seq1Even = emptySeqOfNat() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +emptySeqOfNat : () -> seq of nat +emptySeqOfNat () == []; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result new file mode 100644 index 0000000000..e723e56146 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result @@ -0,0 +1,10 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:32: JML assertion is false + //@ assert ((V2J.isSeq1(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))) && inv_Entry_Seq1Even(ignorePattern_2)); + ^ +Entry.java:40: JML assertion is false + //@ assert ((V2J.isSeq1(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.get(ignorePattern_3,i)))) && inv_Entry_Seq1Even(ignorePattern_3)); + ^ +"After illegal use" \ No newline at end of file From 7ac5df225092acd4e3ab58d0b0701361b1b5639b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 18:42:03 +0200 Subject: [PATCH 164/706] Test compatibility of 'isSet' runtime method --- .../org/overture/vdm2jml/tests/V2JCallTests.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java index 5fac562ffd..f2ff03f0f4 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java @@ -6,11 +6,19 @@ import org.junit.Assert; import org.junit.Test; import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.predgen.info.AbstractCollectionInfo; import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; +import org.overture.codegen.vdm2jml.predgen.info.SetInfo; import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; public class V2JCallTests { + @Test + public void checkIsSet() + { + assertMethod(SetInfo.IS_SET_METHOD, Object.class); + } + @Test public void checkIsTup() { @@ -26,13 +34,13 @@ public void checkTupField() @Test public void checkGetSeqElement() { - assertMethod(SeqInfo.GET_METHOD, Object.class, int.class); + assertMethod(AbstractCollectionInfo.GET_METHOD, Object.class, int.class); } @Test public void checkSeqSize() { - assertMethod(SeqInfo.SIZE__METHOD, Object.class); + assertMethod(AbstractCollectionInfo.SIZE__METHOD, Object.class); } @Test From e9abda496ef0aa7af10c9761c35d4bd46357d6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 18:44:55 +0200 Subject: [PATCH 165/706] Refactoring of 'SeqInfo' functionality --- .../predgen/info/AbstractCollectionInfo.java | 69 +++++++++++++++++++ .../codegen/vdm2jml/predgen/info/SeqInfo.java | 58 ++-------------- 2 files changed, 74 insertions(+), 53 deletions(-) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java new file mode 100644 index 0000000000..0db56b5cac --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java @@ -0,0 +1,69 @@ +package org.overture.codegen.vdm2jml.predgen.info; + +import java.util.LinkedList; +import java.util.List; + +import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.util.NameGen; + +public abstract class AbstractCollectionInfo extends AbstractTypeInfo +{ + public static final String GET_METHOD = "get"; + public static final String ITE_VAR_NAME_PREFIX = "i"; + public static final String SIZE__METHOD = "size"; + + protected AbstractTypeInfo elementType; + + public AbstractCollectionInfo(boolean optional, AbstractTypeInfo elementType) + { + super(optional); + this.elementType = elementType; + } + + @Override + public boolean allowsNull() + { + return optional; + } + + @Override + public List getLeafTypesRecursively() + { + return new LinkedList<>(); + } + + abstract public String consCollectionCheck(String arg); + + @Override + public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) + { + String isColCheck = consCollectionCheck(arg); + String sizeCall = consSubjectCheck(V2J.class.getSimpleName(), SIZE__METHOD, arg); + String iteVar = nameGen.getName(ITE_VAR_NAME_PREFIX); + String elementArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_METHOD, arg, iteVar); + String elementCheck = elementType.consCheckExp(enclosingClass, javaRootPackage, elementArg, nameGen); + + StringBuilder sb = new StringBuilder(); + sb.append(isColCheck); + sb.append(JmlGenerator.JML_AND); + sb.append('('); + sb.append(String.format("\\forall int %1$s; 0 <= %1$s && %1$s < ", iteVar)); + sb.append(sizeCall); + sb.append("; "); + sb.append(elementCheck); + sb.append(')'); + + // (V2J.isSeq(seq) && (\forall int i; 0 <= i && i < V2JL.size(seq); Utils.is_nat(V2JL.get(seq,i)))); + String seqCheckExp = "(" + sb.toString() + ")"; + + if(allowsNull()) + { + return "(" + consIsNullCheck(arg) + JmlGenerator.JML_OR + seqCheckExp + ")"; + } + else + { + return seqCheckExp; + } + } +} \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java index ee778fe667..09738ce872 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java @@ -1,71 +1,23 @@ package org.overture.codegen.vdm2jml.predgen.info; -import java.util.LinkedList; -import java.util.List; - import org.overture.codegen.runtime.V2J; -import org.overture.codegen.vdm2jml.JmlGenerator; -import org.overture.codegen.vdm2jml.util.NameGen; -public class SeqInfo extends AbstractTypeInfo +public class SeqInfo extends AbstractCollectionInfo { - public static final String GET_METHOD = "get"; - public static final String ITE_VAR_NAME_PREFIX = "i"; - public static final String SIZE__METHOD = "size"; public static final String IS_SEQ_METHOD = "isSeq"; public static final String IS_SEQ1_METHOD = "isSeq1"; - private AbstractTypeInfo elementType; - private boolean isSeq1; + protected boolean isSeq1; public SeqInfo(boolean optional, AbstractTypeInfo elementType, boolean isSeq1) { - super(optional); - this.elementType = elementType; + super(optional, elementType); this.isSeq1 = isSeq1; } @Override - public boolean allowsNull() - { - return optional; - } - - @Override - public List getLeafTypesRecursively() - { - return new LinkedList<>(); - } - - @Override - public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) + public String consCollectionCheck(String arg) { - String isSeqCheck = consSubjectCheck(V2J.class.getSimpleName(), isSeq1 ? IS_SEQ1_METHOD : IS_SEQ_METHOD, arg); - String sizeCall = consSubjectCheck(V2J.class.getSimpleName(), SIZE__METHOD, arg); - String iteVar = nameGen.getName(ITE_VAR_NAME_PREFIX); - String elemtnArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_METHOD, arg, iteVar); - String elemtCheck = elementType.consCheckExp(enclosingClass, javaRootPackage, elemtnArg, nameGen); - - StringBuilder sb = new StringBuilder(); - sb.append(isSeqCheck); - sb.append(JmlGenerator.JML_AND); - sb.append('('); - sb.append(String.format("\\forall int %1$s; 0 <= %1$s && %1$s < ", iteVar)); - sb.append(sizeCall); - sb.append("; "); - sb.append(elemtCheck); - sb.append(')'); - - // (V2J.isSeq(seq) && (\forall int i; 0 <= i && i < V2JL.size(seq); Utils.is_nat(V2JL.get(seq,i)))); - String seqCheckExp = "(" + sb.toString() + ")"; - - if(allowsNull()) - { - return "(" + consIsNullCheck(arg) + JmlGenerator.JML_OR + seqCheckExp + ")"; - } - else - { - return seqCheckExp; - } + return consSubjectCheck(V2J.class.getSimpleName(), isSeq1 ? IS_SEQ1_METHOD : IS_SEQ_METHOD, arg); } } From 3b736e73a88fb334e24fb0a4a66cff0bf614cffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 18:46:06 +0200 Subject: [PATCH 166/706] Add support for checking of set types --- .../codegen/vdm2jml/predgen/TypePredUtil.java | 12 +++++++++-- .../info/NamedTypeInvDepCalculator.java | 9 +++++++-- .../codegen/vdm2jml/predgen/info/SetInfo.java | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index 58a69216da..dfdd9c08ab 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -27,6 +27,7 @@ import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; +import org.overture.codegen.vdm2jml.predgen.info.SetInfo; import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; import org.overture.codegen.vdm2jml.predgen.info.UnionInfo; import org.overture.codegen.vdm2jml.predgen.info.UnknownLeaf; @@ -260,9 +261,16 @@ else if(type instanceof ATupleTypeCG) else if(type instanceof ASeqSeqTypeCG) { ASeqSeqTypeCG seqType = ((ASeqSeqTypeCG) type); - STypeCG t = seqType.getSeqOf(); + STypeCG elementType = seqType.getSeqOf(); - return new SeqInfo(assist.allowsNull(type), findTypeInfo(t), BooleanUtils.isTrue(seqType.getSeq1())); + return new SeqInfo(assist.allowsNull(type), findTypeInfo(elementType), BooleanUtils.isTrue(seqType.getSeq1())); + } + else if(type instanceof ASetSetTypeCG) + { + ASetSetTypeCG setType = (ASetSetTypeCG) type; + STypeCG elementType = setType.getSetOf(); + + return new SetInfo(assist.allowsNull(type), findTypeInfo(elementType)); } else if(type instanceof AUnknownTypeCG || type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG) { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index c3d112be54..9bea712958 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -17,7 +17,6 @@ import org.overture.ast.types.AUnionType; import org.overture.ast.types.AUnknownType; import org.overture.ast.types.PType; -import org.overture.ast.types.SSeqType; import org.overture.ast.types.SSeqTypeBase; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.ir.IRInfo; @@ -160,11 +159,17 @@ private static AbstractTypeInfo create(IRInfo info, PType type, Set visit } else if(type instanceof SSeqTypeBase) { - SSeqType seqType = (SSeqType) type; + SSeqTypeBase seqType = (SSeqTypeBase) type; boolean isSeq1 = seqType instanceof ASeq1SeqType; return new SeqInfo(optional, create(info, seqType.getSeqof(), visited), isSeq1); } + else if(type instanceof ASetType) + { + ASetType setType = (ASetType) type; + + return new SetInfo(optional, create(info, setType.getSetof(), visited)); + } else if(type instanceof AUnknownType || type instanceof ASetType || type instanceof AMapMapType) { return new UnknownLeaf(); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java new file mode 100644 index 0000000000..0a0814a121 --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java @@ -0,0 +1,20 @@ +package org.overture.codegen.vdm2jml.predgen.info; + +import org.overture.codegen.runtime.V2J; + +public class SetInfo extends AbstractCollectionInfo +{ + public static final String IS_SET_METHOD = "isSet"; + + public SetInfo(boolean optional, AbstractTypeInfo elementType) + { + super(optional, elementType); + } + + @Override + public String consCollectionCheck(String arg) + { + return consSubjectCheck(V2J.class.getSimpleName(), IS_SET_METHOD, arg); + } + +} From e851f56d561d07e5b16c14ac0fd92f0f01dc4cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 18:46:40 +0200 Subject: [PATCH 167/706] Prepare testing of JML generation of set types --- .../tests/exec/JmlSetTypeExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSetTypeExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSetTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSetTypeExecTests.java new file mode 100644 index 0000000000..10e759094b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSetTypeExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlSetTypeExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "settype"; + + public static final String PROPERTY_ID = "settype"; + + public JmlSetTypeExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From 98793251381996c9c0e7094c71039ee9ca10701f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 15 Oct 2015 18:48:03 +0200 Subject: [PATCH 168/706] Add tests to exercise JML generation of set types --- .../settype/SetOfNat/Entry.java | 53 +++++++++++++++++++ .../settype/SetOfNat/SetOfNat.vdmsl | 26 +++++++++ .../settype/SetOfNat/SetOfNat.vdmsl.result | 7 +++ 3 files changed, 86 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/Entry.java new file mode 100644 index 0000000000..cd94387314 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/Entry.java @@ -0,0 +1,53 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMSet ignorePattern_1 = SetUtil.set(2L, 4L, 6L); + + //@ assert (V2J.isSet(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat(V2J.get(ignorePattern_1,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMSet ignorePattern_2 = setOfNat(); + + //@ assert (V2J.isSet(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static VDMSet setOfNat() { + VDMSet ret_1 = null; + + //@ assert ((ret_1 == null) || (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.get(ret_1,i))))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl new file mode 100644 index 0000000000..cc713ed03b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl @@ -0,0 +1,26 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : set of nat = {2,4,6} in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : set of nat = setOfNat() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +setOfNat : () -> [set of nat] +setOfNat () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl.result new file mode 100644 index 0000000000..f51cf4f7a2 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:32: JML assertion is false + //@ assert (V2J.isSet(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); + ^ +"After illegal use" \ No newline at end of file From e3dadebf3f7e64290abb671e5109c0659535430b Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Fri, 16 Oct 2015 14:32:35 +0200 Subject: [PATCH 169/706] Copy AlarmUML example as part of product build. Issue: --- ide/product/src/main/resources/overture.p2.inf | 1 + 1 file changed, 1 insertion(+) diff --git a/ide/product/src/main/resources/overture.p2.inf b/ide/product/src/main/resources/overture.p2.inf index 7bbdf3c03b..9348d57732 100644 --- a/ide/product/src/main/resources/overture.p2.inf +++ b/ide/product/src/main/resources/overture.p2.inf @@ -3,6 +3,7 @@ instructions.configure=\ copy(source:${documentation.root}/VDM10LangMan/VDM10_lang_man.pdf,target:${installFolder}/documentation/VDM10_lang_man.pdf,overwrite:true);\ copy(source:${documentation.root}/UserGuideOvertureIDE/OvertureIDEUserGuide.pdf,target:${installFolder}/documentation/OvertureIDEUserGuide.pdf,overwrite:true);\ copy(source:${documentation.root}/tutorials/VDM++OvertureTutorial/VDMPPGuideToOverture.pdf,target:${installFolder}/documentation/VDMPPGuideToOverture.pdf,overwrite:true);\ + copy(source:${documentation.root}/tutorials/VDM++OvertureTutorial/AlarmInitUML.uml,target:${installFolder}/documentation/AlarmInitUML.uml,overwrite:true);\ copy(source:${documentation.root}/tutorials/VDMRTOvertureTutorial/VDMRTGuideToOverture.pdf,target:${installFolder}/documentation/VDMRTGuideToOverture.pdf,overwrite:true);\ copy(source:${documentation.root}/tutorials/VDMSLOvertureTutorial/VDMSLGuideToOverture.pdf,target:${installFolder}/documentation/VDMSLGuideToOverture.pdf,overwrite:true);\ copy(source:${documentation.root}/VDMRTProcess/VDMRTProcess.pdf,target:${installFolder}/documentation/VDMRTProcess.pdf,overwrite:true);\ From f4c2cfddeb02e6918d3f383cc71bc7a64d14bcf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 16 Oct 2015 19:55:29 +0200 Subject: [PATCH 170/706] Recent type checker tweaks require VDM10 test model to be updated --- .../complex_expressions/MethodInstantiation.vdmpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/MethodInstantiation.vdmpp b/core/codegen/javagen/src/test/resources/complex_expressions/MethodInstantiation.vdmpp index a04726d03c..5e80269975 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/MethodInstantiation.vdmpp +++ b/core/codegen/javagen/src/test/resources/complex_expressions/MethodInstantiation.vdmpp @@ -5,15 +5,17 @@ functions public f1: () -> nat f1() == g[nat,real](1,2); -public f2: () -> A -f2() == g[A,real](new A(),2); - public g[@T, @U]:@T * @U -> @T -g(arg1, arg2) == +g(arg1, -) == arg1; -public go : () -> nat -go () == f1() + f2().f1() + new A().f1() + g[nat,char](1,'a'); +operations + +public go : () ==> nat +go () == return f1() + f2().f1() + new A().f1() + g[nat,char](1,'a'); + +public f2: () ==> A +f2() == return g[A,real](new A(),2); end A From 9253e366c862fd7ea5b46a7c689cfcae045694ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 16 Oct 2015 20:12:31 +0200 Subject: [PATCH 171/706] Fix: cloning of explicit variable was missing --- .../resources/JavaTemplates/Expressions/ExplicitVariable.vm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/codegen/javagen/src/main/resources/JavaTemplates/Expressions/ExplicitVariable.vm b/core/codegen/javagen/src/main/resources/JavaTemplates/Expressions/ExplicitVariable.vm index bb0bfe8f94..d2b00299b1 100644 --- a/core/codegen/javagen/src/main/resources/JavaTemplates/Expressions/ExplicitVariable.vm +++ b/core/codegen/javagen/src/main/resources/JavaTemplates/Expressions/ExplicitVariable.vm @@ -1 +1,5 @@ -$JavaFormat.format($node.getClassType()).$node.getName() \ No newline at end of file +#if ($ValueSemantics.shouldClone($node)) +Utils.copy($JavaFormat.format($node.getClassType()).$node.getName())## +#else +$JavaFormat.format($node.getClassType()).$node.getName()## +#end \ No newline at end of file From 5e345af38c9c8882995285a34ba302519c49d671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 16 Oct 2015 20:21:53 +0200 Subject: [PATCH 172/706] Updates to Java code generator result files Expect static variables to always be fully qualified --- .../classic_specs/AlarmTraces.vdmpp.result | 9 +-- .../CashDispenserPP.vdmpp.result | 38 +++++++------ .../cloning_specs/AlarmTraces.vdmpp.result | 9 +-- .../CashDispenserPP.vdmpp.result | 38 +++++++------ .../cloning_specs/TupleUsage.vdmpp.result | 2 +- .../ApplyObjectDesignatorClone.vdmpp.result | 4 +- .../ApplyObjectDesignatorMapType.vdmpp.result | 12 ++-- .../IfExpAndExpBranch.vdmpp.result | 4 +- .../MapCompBlockStm.vdmpp.result | 2 +- ...apSeqStateDesignatorMapUpdate.vdmpp.result | 2 +- .../MethodInstantiation.vdmpp.result | 16 +++--- .../OrExpEvalOrder.vdmpp.result | 2 +- .../SeqCompBlockStm.vdmpp.result | 2 +- .../SeqConversion.vdmpp.result | 4 +- .../SeqModWithVarOperands.vdmpp.result | 2 +- .../SetCompBlockStm.vdmpp.result | 2 +- .../TokenType.vdmpp.result | 2 +- .../POP3_LogBased_Test1.vdmpp.result | 56 +++++++++---------- .../LetBeStRecPattern.vdmpp.result | 2 +- .../renaming_specs/ValueDef.vdmpp.result | 2 +- .../resources/rt/AsyncCounterInc.vdmrt.result | 4 +- .../ClassComparison.vdmpp.result | 4 +- .../ElemsTypeInference.vdmpp.result | 8 +-- .../MapComparisonClone.vdmpp.result | 4 +- .../specifications/MapDomClone.vdmpp.result | 2 +- .../MapDomResByClone.vdmpp.result | 2 +- .../MapDomResToClone.vdmpp.result | 2 +- .../MapInverseClone.vdmpp.result | 2 +- .../MapMapUnionClone.vdmpp.result | 2 +- .../specifications/MapMergeClone.vdmpp.result | 2 +- .../MapOverrideClone.vdmpp.result | 2 +- .../specifications/MapRangeClone.vdmpp.result | 2 +- .../MapRangeResByClone.vdmpp.result | 2 +- .../MapRangeResToClone.vdmpp.result | 2 +- .../specifications/MathLib.vdmpp.result | 32 +++++------ .../specifications/RecordNesting.vdmpp.result | 2 +- .../specifications/RecordUsage.vdmpp.result | 2 +- .../specifications/SeqModCloning.vdmpp.result | 2 +- .../SeqReverseBasicTypes.vdmpp.result | 12 ++-- .../specifications/SetDiffClone.vdmpp.result | 2 +- .../SetDistInterClone.vdmpp.result | 4 +- .../SetDistUnionClone.vdmpp.result | 4 +- .../SetIntersectClone.vdmpp.result | 2 +- .../SetPowerSetClone.vdmpp.result | 4 +- .../SetProperSubsetClone.vdmpp.result | 2 +- .../SetSubsetClone.vdmpp.result | 2 +- .../SetUnionCloning.vdmpp.result | 3 +- .../specifications/TupleUsage.vdmpp.result | 2 +- .../VariableExpressions.vdmpp.result | 4 +- .../string_specs/Concat.vdmpp.result | 2 +- .../resources/string_specs/Elems.vdmpp.result | 4 +- .../resources/string_specs/Head.vdmpp.result | 2 +- .../string_specs/Indexing.vdmpp.result | 2 +- .../string_specs/Indices.vdmpp.result | 3 +- .../string_specs/Modification.vdmpp.result | 3 +- .../string_specs/Reverse.vdmpp.result | 2 +- .../string_specs/SeqConversion.vdmpp.result | 4 +- .../resources/string_specs/Size.vdmpp.result | 2 +- .../resources/string_specs/Tail.vdmpp.result | 2 +- .../LetBeStRecPattern.vdmpp.result | 2 +- .../CallObjStmWithArguments.vdmpp.result | 2 +- .../FieldExpArgToOpCall.vdmpp.result | 2 +- .../FieldExpInReturnStm.vdmpp.result | 2 +- .../FieldExpNotRootOfApplyExp.vdmpp.result | 3 +- .../FieldExpWithObjectAsApplyExp.vdmpp.result | 2 +- .../union_type_specs/IfStm.vdmpp.result | 6 +- .../LetBeStRecElem.vdmpp.result | 2 +- .../union_type_specs/MapApply.vdmpp.result | 2 +- .../MapCompUnionOfMapTypes.vdmpp.result | 2 +- .../union_type_specs/NotExp.vdmpp.result | 2 +- .../union_type_specs/NumericPlus.vdmpp.result | 4 +- .../SeqCompUnionOfSeqTypes.vdmpp.result | 2 +- .../SetCompUnionOfSetTypes.vdmpp.result | 2 +- 73 files changed, 200 insertions(+), 190 deletions(-) diff --git a/core/codegen/javagen/src/test/resources/classic_specs/AlarmTraces.vdmpp.result b/core/codegen/javagen/src/test/resources/classic_specs/AlarmTraces.vdmpp.result index 89cfc1765e..2c5549c294 100644 --- a/core/codegen/javagen/src/test/resources/classic_specs/AlarmTraces.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/classic_specs/AlarmTraces.vdmpp.result @@ -223,7 +223,8 @@ public class Entry { 'd', 'a', 'y', ' ', 'd', 'a', 'y')); private static final Token p4 = new Token(SeqUtil.seq('T', 'u', 'e', 's', 'd', 'a', 'y', ' ', 'n', 'i', 'g', 'h', 't')); - private static final VDMSet ps = SetUtil.set(p1, p2, p3, p4); + private static final VDMSet ps = SetUtil.set(Entry.p1, Entry.p2, Entry.p3, + Entry.p4); private Alarm a1 = new Alarm(quotes.MechQuote.getInstance(), SeqUtil.seq('M', 'e', 'c', 'h', 'a', 'n', 'i', 'c', 'a', 'l', ' ', 'f', 'a', 'u', 'l', 't')); @@ -239,8 +240,8 @@ public class Entry { private Expert ex4 = new Expert(SetUtil.set( quotes.ElecQuote.getInstance(), quotes.ChemQuote.getInstance())); private Plant plant = new Plant(SetUtil.set(a1), - MapUtil.map(new Maplet(p1, SetUtil.set(ex1, ex4)), - new Maplet(p2, SetUtil.set(ex2, ex3)))); + MapUtil.map(new Maplet(Entry.p1, SetUtil.set(ex1, ex4)), + new Maplet(Entry.p2, SetUtil.set(ex2, ex3)))); private VDMSet exs = SetUtil.set(ex1, ex2, ex3, ex4); public Entry() { @@ -249,7 +250,7 @@ public class Entry { public static Object Run() { Entry entry = new Entry(); VDMSet periods = entry.plant.ExpertIsOnDuty(entry.ex1); - Expert expert = entry.plant.ExpertToPage(entry.a1, p1); + Expert expert = entry.plant.ExpertToPage(entry.a1, Entry.p1); return Tuple.mk_(Utils.copy(periods), expert); } diff --git a/core/codegen/javagen/src/test/resources/classic_specs/CashDispenserPP.vdmpp.result b/core/codegen/javagen/src/test/resources/classic_specs/CashDispenserPP.vdmpp.result index 8fbf5c63f7..999f5523da 100644 --- a/core/codegen/javagen/src/test/resources/classic_specs/CashDispenserPP.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/classic_specs/CashDispenserPP.vdmpp.result @@ -26,10 +26,10 @@ import java.util.*; @SuppressWarnings("all") public class SimpleTest { private static final Card c1 = new Card(123456L, 1L, 1L); - private static final VDMSet cards = SetUtil.set(c1); + private static final VDMSet cards = SetUtil.set(SimpleTest.c1); private static final CentralResource resource = new CentralResource(); private static final VDMMap tills = MapUtil.map(new Maplet(1L, - new Till(resource))); + new Till(SimpleTest.resource))); private Clock clock = new Clock(); private Letterbox letterbox = new Letterbox(); @@ -49,9 +49,9 @@ public class SimpleTest { Account pglacc1 = new Account().Create(MapUtil.map( new Maplet(1L, peter)), 5000L); Number pglid1 = 1L; - resource.AddAccount(pglid1, pglacc1); - resource.AddLetterbox(clock, new Letterbox()); - ((Till) Utils.get(tills, 1L)).InsertCard(c1); + SimpleTest.resource.AddAccount(pglid1, pglacc1); + SimpleTest.resource.AddLetterbox(clock, new Letterbox()); + ((Till) Utils.get(SimpleTest.tills, 1L)).InsertCard(SimpleTest.c1); if (Utils.equals(((Till) Utils.get(tills, 1L)).Validate(123456L), quotes.PinOkQuote.getInstance())) { @@ -111,7 +111,7 @@ public class Account { if ((balance.longValue() - amount.longValue()) >= 0L) { if (DateTotal(Utils.copy(date), SeqUtil.conc(Utils.copy(transactions), - SeqUtil.seq(Utils.copy(transaction)))).longValue() <= dailyLimit.longValue()) { + SeqUtil.seq(Utils.copy(transaction)))).longValue() <= Account.dailyLimit.longValue()) { andResult_1 = true; } } @@ -170,7 +170,7 @@ public class Account { iterator_1.hasNext() && forAllExpResult_1;) { VDMSeq date = ((VDMSeq) iterator_1.next()); forAllExpResult_1 = DateTotal(Utils.copy(date), Utils.copy(ts)) - .longValue() <= dailyLimit.longValue(); + .longValue() <= Account.dailyLimit.longValue(); } return forAllExpResult_1; @@ -400,7 +400,7 @@ public class CentralResource { } public Boolean NumberOfTriesExceeded(final Number cardId) { - return ((Number) Utils.get(numberOfTries, cardId)).longValue() >= maxNumberOfTries.longValue(); + return ((Number) Utils.get(numberOfTries, cardId)).longValue() >= CentralResource.maxNumberOfTries.longValue(); } public void ResetNumberOfTries(final Number cardId) { @@ -859,11 +859,13 @@ public class System { private static final Card c5 = new Card(123460L, 5L, 5L); private static final Card c6 = new Card(123461L, 6L, 5L); private static final Card c7 = new Card(123462L, 7L, 5L); - private static final VDMSet cards = SetUtil.set(c1, c2, c3, c4, c5, c6, c7); + private static final VDMSet cards = SetUtil.set(System.c1, System.c2, + System.c3, System.c4, System.c5, System.c6, System.c7); private static final CentralResource resource = new CentralResource(); private static final VDMMap tills = MapUtil.map(new Maplet(1L, - new Till(resource)), new Maplet(2L, new Till(resource)), - new Maplet(3L, new Till(resource))); + new Till(System.resource)), + new Maplet(2L, new Till(System.resource)), + new Maplet(3L, new Till(System.resource))); private Clock clock = new Clock(); private Letterbox letterbox = new Letterbox(); @@ -876,7 +878,7 @@ public class System { } public CentralResource GetResource() { - return resource; + return System.resource; } public void cg_init_System_1() { @@ -920,12 +922,12 @@ public class System { Number ksid1 = 3L; Number pmid1 = 4L; Number ifid1 = 5L; - resource.AddAccount(pglid1, pglacc1); - resource.AddAccount(said1, saacc1); - resource.AddAccount(ksid1, ksacc1); - resource.AddAccount(pmid1, pmacc1); - resource.AddAccount(ifid1, ifacc1); - resource.AddLetterbox(clock, new Letterbox()); + System.resource.AddAccount(pglid1, pglacc1); + System.resource.AddAccount(said1, saacc1); + System.resource.AddAccount(ksid1, ksacc1); + System.resource.AddAccount(pmid1, pmacc1); + System.resource.AddAccount(ifid1, ifacc1); + System.resource.AddLetterbox(clock, new Letterbox()); } } } diff --git a/core/codegen/javagen/src/test/resources/cloning_specs/AlarmTraces.vdmpp.result b/core/codegen/javagen/src/test/resources/cloning_specs/AlarmTraces.vdmpp.result index 8657454b7c..b4f3bcad4f 100644 --- a/core/codegen/javagen/src/test/resources/cloning_specs/AlarmTraces.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/cloning_specs/AlarmTraces.vdmpp.result @@ -220,7 +220,8 @@ public class Entry { 'd', 'a', 'y', ' ', 'd', 'a', 'y')); private static final Token p4 = new Token(SeqUtil.seq('T', 'u', 'e', 's', 'd', 'a', 'y', ' ', 'n', 'i', 'g', 'h', 't')); - private static final VDMSet ps = SetUtil.set(p1, p2, p3, p4); + private static final VDMSet ps = SetUtil.set(Entry.p1, Entry.p2, Entry.p3, + Entry.p4); private Alarm a1 = new Alarm(quotes.MechQuote.getInstance(), SeqUtil.seq('M', 'e', 'c', 'h', 'a', 'n', 'i', 'c', 'a', 'l', ' ', 'f', 'a', 'u', 'l', 't')); @@ -236,8 +237,8 @@ public class Entry { private Expert ex4 = new Expert(SetUtil.set( quotes.ElecQuote.getInstance(), quotes.ChemQuote.getInstance())); private Plant plant = new Plant(SetUtil.set(a1), - MapUtil.map(new Maplet(p1, SetUtil.set(ex1, ex4)), - new Maplet(p2, SetUtil.set(ex2, ex3)))); + MapUtil.map(new Maplet(Entry.p1, SetUtil.set(ex1, ex4)), + new Maplet(Entry.p2, SetUtil.set(ex2, ex3)))); private VDMSet exs = SetUtil.set(ex1, ex2, ex3, ex4); public Entry() { @@ -246,7 +247,7 @@ public class Entry { public static Object Run() { Entry entry = new Entry(); VDMSet periods = entry.plant.ExpertIsOnDuty(entry.ex1); - Expert expert = entry.plant.ExpertToPage(entry.a1, p1); + Expert expert = entry.plant.ExpertToPage(entry.a1, Entry.p1); return Tuple.mk_(periods, expert); } diff --git a/core/codegen/javagen/src/test/resources/cloning_specs/CashDispenserPP.vdmpp.result b/core/codegen/javagen/src/test/resources/cloning_specs/CashDispenserPP.vdmpp.result index 186a713e30..a29c7a77c7 100644 --- a/core/codegen/javagen/src/test/resources/cloning_specs/CashDispenserPP.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/cloning_specs/CashDispenserPP.vdmpp.result @@ -26,10 +26,10 @@ import java.util.*; @SuppressWarnings("all") public class SimpleTest { private static final Card c1 = new Card(123456L, 1L, 1L); - private static final VDMSet cards = SetUtil.set(c1); + private static final VDMSet cards = SetUtil.set(SimpleTest.c1); private static final CentralResource resource = new CentralResource(); private static final VDMMap tills = MapUtil.map(new Maplet(1L, - new Till(resource))); + new Till(SimpleTest.resource))); private Clock clock = new Clock(); private Letterbox letterbox = new Letterbox(); @@ -49,9 +49,9 @@ public class SimpleTest { Account pglacc1 = new Account().Create(MapUtil.map( new Maplet(1L, peter)), 5000L); Number pglid1 = 1L; - resource.AddAccount(pglid1, pglacc1); - resource.AddLetterbox(clock, new Letterbox()); - ((Till) Utils.get(tills, 1L)).InsertCard(c1); + SimpleTest.resource.AddAccount(pglid1, pglacc1); + SimpleTest.resource.AddLetterbox(clock, new Letterbox()); + ((Till) Utils.get(SimpleTest.tills, 1L)).InsertCard(SimpleTest.c1); if (Utils.equals(((Till) Utils.get(tills, 1L)).Validate(123456L), quotes.PinOkQuote.getInstance())) { @@ -111,7 +111,7 @@ public class Account { if ((balance.longValue() - amount.longValue()) >= 0L) { if (DateTotal(date, SeqUtil.conc(transactions, SeqUtil.seq(transaction))) - .longValue() <= dailyLimit.longValue()) { + .longValue() <= Account.dailyLimit.longValue()) { andResult_1 = true; } } @@ -165,7 +165,7 @@ public class Account { for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext() && forAllExpResult_1;) { VDMSeq date = ((VDMSeq) iterator_1.next()); - forAllExpResult_1 = DateTotal(date, ts).longValue() <= dailyLimit.longValue(); + forAllExpResult_1 = DateTotal(date, ts).longValue() <= Account.dailyLimit.longValue(); } return forAllExpResult_1; @@ -395,7 +395,7 @@ public class CentralResource { } public Boolean NumberOfTriesExceeded(final Number cardId) { - return ((Number) Utils.get(numberOfTries, cardId)).longValue() >= maxNumberOfTries.longValue(); + return ((Number) Utils.get(numberOfTries, cardId)).longValue() >= CentralResource.maxNumberOfTries.longValue(); } public void ResetNumberOfTries(final Number cardId) { @@ -853,11 +853,13 @@ public class System { private static final Card c5 = new Card(123460L, 5L, 5L); private static final Card c6 = new Card(123461L, 6L, 5L); private static final Card c7 = new Card(123462L, 7L, 5L); - private static final VDMSet cards = SetUtil.set(c1, c2, c3, c4, c5, c6, c7); + private static final VDMSet cards = SetUtil.set(System.c1, System.c2, + System.c3, System.c4, System.c5, System.c6, System.c7); private static final CentralResource resource = new CentralResource(); private static final VDMMap tills = MapUtil.map(new Maplet(1L, - new Till(resource)), new Maplet(2L, new Till(resource)), - new Maplet(3L, new Till(resource))); + new Till(System.resource)), + new Maplet(2L, new Till(System.resource)), + new Maplet(3L, new Till(System.resource))); private Clock clock = new Clock(); private Letterbox letterbox = new Letterbox(); @@ -870,7 +872,7 @@ public class System { } public CentralResource GetResource() { - return resource; + return System.resource; } public void cg_init_System_1() { @@ -914,12 +916,12 @@ public class System { Number ksid1 = 3L; Number pmid1 = 4L; Number ifid1 = 5L; - resource.AddAccount(pglid1, pglacc1); - resource.AddAccount(said1, saacc1); - resource.AddAccount(ksid1, ksacc1); - resource.AddAccount(pmid1, pmacc1); - resource.AddAccount(ifid1, ifacc1); - resource.AddLetterbox(clock, new Letterbox()); + System.resource.AddAccount(pglid1, pglacc1); + System.resource.AddAccount(said1, saacc1); + System.resource.AddAccount(ksid1, ksacc1); + System.resource.AddAccount(pmid1, pmacc1); + System.resource.AddAccount(ifid1, ifacc1); + System.resource.AddLetterbox(clock, new Letterbox()); } } } diff --git a/core/codegen/javagen/src/test/resources/cloning_specs/TupleUsage.vdmpp.result b/core/codegen/javagen/src/test/resources/cloning_specs/TupleUsage.vdmpp.result index c7b0cc5144..1d629203d2 100644 --- a/core/codegen/javagen/src/test/resources/cloning_specs/TupleUsage.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/cloning_specs/TupleUsage.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class Entry { private static final Tuple a = Tuple.mk_(Tuple.mk_(1L, true), 3L); - private static final Tuple b = a; + private static final Tuple b = Entry.a; private static final Tuple c = ((Tuple) a.get(0)); private static final Number d = ((Number) ((Tuple) a.get(0)).get(0)); private static final Boolean e = ((Boolean) ((Tuple) a.get(0)).get(1)); diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/ApplyObjectDesignatorClone.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/ApplyObjectDesignatorClone.vdmpp.result index e8ae87b3d8..42430c705c 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/ApplyObjectDesignatorClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/ApplyObjectDesignatorClone.vdmpp.result @@ -18,7 +18,7 @@ public class A { public Number op1() { Tuple a = Tuple.mk_(1L, 2L); - return ((A) Utils.get(x, a)).no(); + return ((A) Utils.get(A.x, a)).no(); } public Number op2() { @@ -29,7 +29,7 @@ public class A { } public VDMMap m(final Tuple p, final Tuple q) { - return Utils.copy(x); + return Utils.copy(A.x); } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/ApplyObjectDesignatorMapType.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/ApplyObjectDesignatorMapType.vdmpp.result index 6b02fef1a7..affe2e784b 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/ApplyObjectDesignatorMapType.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/ApplyObjectDesignatorMapType.vdmpp.result @@ -16,16 +16,16 @@ public class X { } public Number m1() { - return ((X) Utils.get(xs, 1L)).f(); + return ((X) Utils.get(X.xs, 1L)).f(); } public Number m2() { - return ((X) Utils.get(((VDMMap) Utils.get(ys, 1L)), 1L)).f(); + return ((X) Utils.get(((VDMMap) Utils.get(X.ys, 1L)), 1L)).f(); } public Number m3() { return ((X) Utils.get(((VDMMap) Utils.get( - ((VDMMap) Utils.get(zs, 1L)), 1L)), 1L)).f(); + ((VDMMap) Utils.get(X.zs, 1L)), 1L)), 1L)).f(); } public Number m4() { @@ -46,15 +46,15 @@ public class X { } public VDMMap map_xs(final Number pa, final Number pb) { - return Utils.copy(xs); + return Utils.copy(X.xs); } public VDMMap map_ys(final Number pa, final Number pb) { - return Utils.copy(ys); + return Utils.copy(X.ys); } public VDMMap map_zs(final Number pa, final Number pb) { - return Utils.copy(zs); + return Utils.copy(X.zs); } public static Number f() { diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/IfExpAndExpBranch.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/IfExpAndExpBranch.vdmpp.result index 4f88e6efc5..6eb2ce406d 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/IfExpAndExpBranch.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/IfExpAndExpBranch.vdmpp.result @@ -11,7 +11,7 @@ public class Entry { } public static Number id(final Number x) { - xs = SeqUtil.conc(Utils.copy(xs), SeqUtil.seq(x)); + xs = SeqUtil.conc(Utils.copy(Entry.xs), SeqUtil.seq(x)); return x; } @@ -47,7 +47,7 @@ public class Entry { public static Object Run() { Boolean ignorePattern_1 = op(); - return Utils.copy(xs); + return Utils.copy(Entry.xs); } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/MapCompBlockStm.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/MapCompBlockStm.vdmpp.result index e9bc697def..05ce70b0f8 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/MapCompBlockStm.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/MapCompBlockStm.vdmpp.result @@ -16,7 +16,7 @@ public class Entry { public static VDMMap Test() { VDMMap mapCompResult_1 = MapUtil.map(); - VDMSet set_1 = SeqUtil.elems(Utils.copy(s)); + VDMSet set_1 = SeqUtil.elems(Utils.copy(Entry.s)); for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { Number x = ((Number) iterator_1.next()); diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/MapSeqStateDesignatorMapUpdate.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/MapSeqStateDesignatorMapUpdate.vdmpp.result index ea2c273308..8c42b9b839 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/MapSeqStateDesignatorMapUpdate.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/MapSeqStateDesignatorMapUpdate.vdmpp.result @@ -13,7 +13,7 @@ public class Entry { public static Object Run() { Utils.mapSeqUpdate(x, 4L, false); - return Utils.copy(x); + return Utils.copy(Entry.x); } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/MethodInstantiation.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/MethodInstantiation.vdmpp.result index 75a76d16f4..e78816e9f3 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/MethodInstantiation.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/MethodInstantiation.vdmpp.result @@ -8,21 +8,21 @@ public class A { public A() { } - public static Number f1() { - return g(1L, 2L); + public Number go() { + return f1().longValue() + f2().f1().longValue() + + new A().f1().longValue() + g(1L, 'a').longValue(); } - public static A f2() { + public A f2() { return g(new A(), 2L); } - public static T g(final T arg1, final U arg2) { - return arg1; + public static Number f1() { + return g(1L, 2L); } - public static Number go() { - return f1().longValue() + f2().f1().longValue() + - new A().f1().longValue() + g(1L, 'a').longValue(); + public static T g(final T arg1, final U ignorePattern_1) { + return arg1; } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/OrExpEvalOrder.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/OrExpEvalOrder.vdmpp.result index 2ee8dedae0..49d36dc926 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/OrExpEvalOrder.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/OrExpEvalOrder.vdmpp.result @@ -20,7 +20,7 @@ public class A { } public Boolean test() { - a = a.longValue() + 1L; + a = A.a.longValue() + 1L; return n.longValue() > 6L; } diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/SeqCompBlockStm.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/SeqCompBlockStm.vdmpp.result index 08a64cf5d6..eb40e65071 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/SeqCompBlockStm.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/SeqCompBlockStm.vdmpp.result @@ -16,7 +16,7 @@ public class Entry { public static VDMSeq Test() { VDMSeq seqCompResult_1 = SeqUtil.seq(); - VDMSet set_1 = SeqUtil.elems(Utils.copy(s)); + VDMSet set_1 = SeqUtil.elems(Utils.copy(Entry.s)); for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { Number x = ((Number) iterator_1.next()); diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/SeqConversion.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/SeqConversion.vdmpp.result index 01c972df9d..a487dae028 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/SeqConversion.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/SeqConversion.vdmpp.result @@ -67,8 +67,8 @@ public class Entry { public static VDMSeq Run() { return SeqUtil.conc(SeqUtil.conc(SeqUtil.conc(SeqUtil.conc(SeqUtil.conc( - SeqUtil.conc(SeqUtil.conc(Utils.copy(x), f()), op1()), - op2()), op3()), op5()), op6()), op7()); + SeqUtil.conc(SeqUtil.conc(Utils.copy(Entry.x), f()), + op1()), op2()), op3()), op5()), op6()), op7()); } public static VDMSeq f() { diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/SeqModWithVarOperands.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/SeqModWithVarOperands.vdmpp.result index 0c0d7d0330..2903888219 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/SeqModWithVarOperands.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/SeqModWithVarOperands.vdmpp.result @@ -12,7 +12,7 @@ public class Entry { } public static Object Run() { - return SeqUtil.mod(Utils.copy(s), Utils.copy(m)); + return SeqUtil.mod(Utils.copy(Entry.s), Utils.copy(Entry.m)); } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/SetCompBlockStm.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/SetCompBlockStm.vdmpp.result index 0870c7166b..efd303ed81 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/SetCompBlockStm.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/SetCompBlockStm.vdmpp.result @@ -16,7 +16,7 @@ public class Entry { public static VDMSet Test() { VDMSet setCompResult_1 = SetUtil.set(); - VDMSet set_1 = SeqUtil.elems(Utils.copy(s)); + VDMSet set_1 = SeqUtil.elems(Utils.copy(Entry.s)); for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { Number x = ((Number) iterator_1.next()); diff --git a/core/codegen/javagen/src/test/resources/complex_expressions/TokenType.vdmpp.result b/core/codegen/javagen/src/test/resources/complex_expressions/TokenType.vdmpp.result index 7aa8af16c1..be4a0fb71a 100644 --- a/core/codegen/javagen/src/test/resources/complex_expressions/TokenType.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/complex_expressions/TokenType.vdmpp.result @@ -11,7 +11,7 @@ public class Entry { } public static Object Run() { - return x; + return Entry.x; } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/concurrency_classics_specs/POP3_LogBased_Test1.vdmpp.result b/core/codegen/javagen/src/test/resources/concurrency_classics_specs/POP3_LogBased_Test1.vdmpp.result index dffc694203..f34057aaad 100644 --- a/core/codegen/javagen/src/test/resources/concurrency_classics_specs/POP3_LogBased_Test1.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/concurrency_classics_specs/POP3_LogBased_Test1.vdmpp.result @@ -76,11 +76,11 @@ public class Log implements EvaluatePP { } public static Log getInstance() { - if (Utils.equals(Instance, null)) { + if (Utils.equals(Log.Instance, null)) { Instance = new Log(); } - return Instance; + return Log.Instance; } public void log(final String msg) { @@ -635,9 +635,9 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { Object ternaryIfExp_1 = null; if (b) { - ternaryIfExp_1 = new POP3Types.OkResponse(quitMsg); + ternaryIfExp_1 = new POP3Types.OkResponse(POP3ClientHandler.quitMsg); } else { - ternaryIfExp_1 = new POP3Types.ErrResponse(deleteFailMsg); + ternaryIfExp_1 = new POP3Types.ErrResponse(POP3ClientHandler.deleteFailMsg); } response = ternaryIfExp_1; @@ -647,7 +647,7 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { throw new RuntimeException("ERROR statement reached"); } } else { - response = new POP3Types.OkResponse(quitMsg); + response = new POP3Types.OkResponse(POP3ClientHandler.quitMsg); } return response; @@ -665,7 +665,7 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { int2string(parent.GetNumberOfMessages(user)) + " " + int2string(parent.GetMailBoxSize(user))); } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveSTAT); @@ -693,10 +693,10 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { Utils.copy(msgs)) + "\n" + MakeScanListing(Utils.copy(msgs))); } else { - return new POP3Types.ErrResponse(unknownMessageMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.unknownMessageMsg); } } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveLIST); @@ -716,10 +716,10 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { return new POP3Types.OkResponse(sizeText + "\n" + msgText); } else { - return new POP3Types.ErrResponse(unknownMessageMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.unknownMessageMsg); } } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveRETR); @@ -738,13 +738,13 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { int2string(retr.messageNumber) + " deleted"); } else { if (parent.MessageIsDeleted(user, retr.messageNumber)) { - return new POP3Types.ErrResponse(alreadyDeletedMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.alreadyDeletedMsg); } else { - return new POP3Types.ErrResponse(unknownMessageMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.unknownMessageMsg); } } } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveDELE); @@ -758,7 +758,7 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { if (Utils.equals(ss, quotes.TransactionQuote.getInstance())) { return new POP3Types.OkResponse(""); } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveNOOP); @@ -775,7 +775,7 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { return new POP3Types.OkResponse("maildrop has " + int2string(parent.GetNumberOfMessages(user)) + " messages"); } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveRSET); @@ -796,10 +796,10 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { MakeMultilineResponse(SeqUtil.subSeq(Utils.copy(lines), 1L, top.numLines))); } else { - return new POP3Types.ErrResponse(unknownMessageMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.unknownMessageMsg); } } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveTOP); @@ -820,10 +820,10 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { return new POP3Types.OkResponse(parent.GetUidl(user, uidl.messageNumber)); } else { - return new POP3Types.ErrResponse(unknownMessageMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.unknownMessageMsg); } } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveUIDL); @@ -838,9 +838,9 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { user = usercmd.name; sentinel.stateChanged(); - return new POP3Types.OkResponse(submitPasswordMsg); + return new POP3Types.OkResponse(POP3ClientHandler.submitPasswordMsg); } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceiveUSER); @@ -865,19 +865,19 @@ public class POP3ClientHandler extends VDMThread implements EvaluatePP { if (parent.AuthenticateUser(user, pass.string)) { if (parent.IsLocked(user)) { - return new POP3Types.ErrResponse(maildropLockedMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.maildropLockedMsg); } else { parent.AcquireLock(id, user); ss = quotes.TransactionQuote.getInstance(); sentinel.stateChanged(); - return new POP3Types.OkResponse(maildropReadyMsg); + return new POP3Types.OkResponse(POP3ClientHandler.maildropReadyMsg); } } else { - return new POP3Types.ErrResponse(passwordFailedMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.passwordFailedMsg); } } else { - return new POP3Types.ErrResponse(negativeStatusMsg); + return new POP3Types.ErrResponse(POP3ClientHandler.negativeStatusMsg); } } finally { sentinel.leaving(((POP3ClientHandler_sentinel) sentinel).ReceivePASS); @@ -2262,7 +2262,7 @@ public class POP3Test implements EvaluatePP { public static VDMMap MakePasswordMap() { VDMMap mapCompResult_1 = MapUtil.map(); - VDMSet set_10 = SeqUtil.inds(users); + VDMSet set_10 = SeqUtil.inds(POP3Test.users); for (Iterator iterator_10 = set_10.iterator(); iterator_10.hasNext();) { Number i = ((Number) iterator_10.next()); @@ -2277,7 +2277,7 @@ public class POP3Test implements EvaluatePP { public static VDMMap MakeMailDrop() { VDMMap mapCompResult_2 = MapUtil.map(); - VDMSet set_11 = SeqUtil.inds(users); + VDMSet set_11 = SeqUtil.inds(POP3Test.users); for (Iterator iterator_11 = set_11.iterator(); iterator_11.hasNext();) { Number i = ((Number) iterator_11.next()); @@ -2293,7 +2293,7 @@ public class POP3Test implements EvaluatePP { public static VDMSeq MakeMessages(final String user) { VDMSeq seqCompResult_7 = SeqUtil.seq(); - VDMSet set_12 = SeqUtil.inds(headers); + VDMSet set_12 = SeqUtil.inds(POP3Test.headers); for (Iterator iterator_12 = set_12.iterator(); iterator_12.hasNext();) { Number i = ((Number) iterator_12.next()); diff --git a/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStRecPattern.vdmpp.result b/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStRecPattern.vdmpp.result index 11e3e2f387..486140d81b 100644 --- a/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStRecPattern.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStRecPattern.vdmpp.result @@ -14,7 +14,7 @@ public class Entry { public static Object Run() { Object recordPattern_1 = null; Boolean success_1 = false; - VDMSet set_1 = Utils.copy(xs); + VDMSet set_1 = Utils.copy(Entry.xs); Number a = null; for (Iterator iterator_1 = set_1.iterator(); diff --git a/core/codegen/javagen/src/test/resources/renaming_specs/ValueDef.vdmpp.result b/core/codegen/javagen/src/test/resources/renaming_specs/ValueDef.vdmpp.result index 25f0187d5d..2ecc0e322e 100644 --- a/core/codegen/javagen/src/test/resources/renaming_specs/ValueDef.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/renaming_specs/ValueDef.vdmpp.result @@ -33,7 +33,7 @@ public class A_X_ { } public Number op() { - return q_X_; + return A_X_.q_X_; } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/rt/AsyncCounterInc.vdmrt.result b/core/codegen/javagen/src/test/resources/rt/AsyncCounterInc.vdmrt.result index 178b3e3cb7..5f9332709f 100644 --- a/core/codegen/javagen/src/test/resources/rt/AsyncCounterInc.vdmrt.result +++ b/core/codegen/javagen/src/test/resources/rt/AsyncCounterInc.vdmrt.result @@ -42,7 +42,7 @@ public class Entry implements EvaluatePP { sentinel.entering(((Entry_sentinel) sentinel).fire); try { - long toVar_1 = AsyncCalls.longValue(); + long toVar_1 = Entry.AsyncCalls.longValue(); for (Long i = 1L; i <= toVar_1; i++) { inc(); @@ -73,7 +73,7 @@ public class Entry implements EvaluatePP { 0L); } else if (Utils.equals(fnr, 1L)) { return Utils.equals(sentinel.fin[((Entry_sentinel) sentinel).inc], - AsyncCalls); + Entry.AsyncCalls); } else if (Utils.equals(fnr, 2L)) { return true; } else if (Utils.equals(fnr, 3L)) { diff --git a/core/codegen/javagen/src/test/resources/specifications/ClassComparison.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/ClassComparison.vdmpp.result index 4dff1b8ecb..818358b69b 100644 --- a/core/codegen/javagen/src/test/resources/specifications/ClassComparison.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/ClassComparison.vdmpp.result @@ -7,8 +7,8 @@ import java.util.*; public class A { public static final A a0 = new A(); public static final A a1 = new A(); - public static final Boolean x = Utils.equals(a0, a0); - public static final Boolean y = Utils.equals(a0, a1); + public static final Boolean x = Utils.equals(A.a0, A.a0); + public static final Boolean y = Utils.equals(A.a0, A.a1); public static final Boolean z = Utils.equals(new A(), new A()); public A() { diff --git a/core/codegen/javagen/src/test/resources/specifications/ElemsTypeInference.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/ElemsTypeInference.vdmpp.result index fb3dac6122..f0cc59b3a6 100644 --- a/core/codegen/javagen/src/test/resources/specifications/ElemsTypeInference.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/ElemsTypeInference.vdmpp.result @@ -6,12 +6,12 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSeq x0 = SeqUtil.seq(); - private static final VDMSet a = SeqUtil.elems(Utils.copy(x0)); + private static final VDMSet a = SeqUtil.elems(Utils.copy(A.x0)); private static final VDMSeq x1 = SeqUtil.seq(1L, 2L, 3L); - private static final VDMSet b = SeqUtil.elems(Utils.copy(x1)); - private static final VDMSet c = SeqUtil.elems(SeqUtil.seq(Utils.copy(x1))); + private static final VDMSet b = SeqUtil.elems(Utils.copy(A.x1)); + private static final VDMSet c = SeqUtil.elems(SeqUtil.seq(Utils.copy(A.x1))); private static final VDMSet d = SeqUtil.elems(SeqUtil.seq(SeqUtil.seq( - Utils.copy(x1)))); + Utils.copy(A.x1)))); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapComparisonClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapComparisonClone.vdmpp.result index 3cb3cc20db..2a2bab4216 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapComparisonClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapComparisonClone.vdmpp.result @@ -6,8 +6,8 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMMap a = MapUtil.map(new Maplet(1L, 2L)); - private static final Boolean b = Utils.equals(a, op()); - private static final Boolean c = !(Utils.equals(a, op())); + private static final Boolean b = Utils.equals(A.a, op()); + private static final Boolean c = !(Utils.equals(A.a, op())); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapDomClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapDomClone.vdmpp.result index 36caac3943..94fa8be99b 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapDomClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapDomClone.vdmpp.result @@ -8,7 +8,7 @@ public class A { private static final VDMMap a = MapUtil.map(new Maplet(1L, 2L)); private static final VDMSet x = MapUtil.dom(MapUtil.map(new Maplet(1L, 2L))); private static final VDMSet y = MapUtil.dom(op()); - private static final VDMSet z = MapUtil.dom(Utils.copy(a)); + private static final VDMSet z = MapUtil.dom(Utils.copy(A.a)); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapDomResByClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapDomResByClone.vdmpp.result index b1877896fe..a6c40c2f8d 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapDomResByClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapDomResByClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L); - private static final VDMMap x = MapUtil.domResBy(Utils.copy(a), m1()); + private static final VDMMap x = MapUtil.domResBy(Utils.copy(A.a), m1()); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapDomResToClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapDomResToClone.vdmpp.result index aae8689746..a478c7e2e0 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapDomResToClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapDomResToClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L); - private static final VDMMap x = MapUtil.domResTo(Utils.copy(a), m1()); + private static final VDMMap x = MapUtil.domResTo(Utils.copy(A.a), m1()); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapInverseClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapInverseClone.vdmpp.result index 86df17f726..5d5f9b5064 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapInverseClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapInverseClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMMap a = MapUtil.map(new Maplet(1L, 2L)); - private static final VDMMap b = MapUtil.inverse(Utils.copy(a)); + private static final VDMMap b = MapUtil.inverse(Utils.copy(A.a)); private static final VDMMap c = MapUtil.inverse(op()); public A() { diff --git a/core/codegen/javagen/src/test/resources/specifications/MapMapUnionClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapMapUnionClone.vdmpp.result index a2bb53c9ab..d3b8b9d369 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapMapUnionClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapMapUnionClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMMap a = MapUtil.map(new Maplet(1L, 2L)); - private static final VDMMap x = MapUtil.munion(Utils.copy(a), op()); + private static final VDMMap x = MapUtil.munion(Utils.copy(A.a), op()); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapMergeClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapMergeClone.vdmpp.result index 55d28339cb..b594c4436b 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapMergeClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapMergeClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMMap a = MapUtil.map(new Maplet(0L, 0L)); - private static final VDMMap x = MapUtil.merge(SetUtil.set(Utils.copy(a), + private static final VDMMap x = MapUtil.merge(SetUtil.set(Utils.copy(A.a), m1())); public A() { diff --git a/core/codegen/javagen/src/test/resources/specifications/MapOverrideClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapOverrideClone.vdmpp.result index e6955de507..d6ef86ea48 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapOverrideClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapOverrideClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMMap a = MapUtil.map(new Maplet(1L, 2L)); - private static final VDMMap x = MapUtil.override(Utils.copy(a), op()); + private static final VDMMap x = MapUtil.override(Utils.copy(A.a), op()); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapRangeClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapRangeClone.vdmpp.result index d768599b09..dd61a135a8 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapRangeClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapRangeClone.vdmpp.result @@ -8,7 +8,7 @@ public class A { private static final VDMMap a = MapUtil.map(new Maplet(1L, 2L)); private static final VDMSet x = MapUtil.rng(MapUtil.map(new Maplet(1L, 2L))); private static final VDMSet y = MapUtil.rng(op()); - private static final VDMSet z = MapUtil.rng(Utils.copy(a)); + private static final VDMSet z = MapUtil.rng(Utils.copy(A.a)); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapRangeResByClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapRangeResByClone.vdmpp.result index 58fb32719e..e5528170df 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapRangeResByClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapRangeResByClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L); - private static final VDMMap x = MapUtil.rngResBy(m1(), Utils.copy(a)); + private static final VDMMap x = MapUtil.rngResBy(m1(), Utils.copy(A.a)); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MapRangeResToClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MapRangeResToClone.vdmpp.result index 84fcf98e03..8be3f8d25c 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MapRangeResToClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MapRangeResToClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L); - private static final VDMMap x = MapUtil.rngResTo(m1(), Utils.copy(a)); + private static final VDMMap x = MapUtil.rngResTo(m1(), Utils.copy(A.a)); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/MathLib.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/MathLib.vdmpp.result index 8194ebbbf5..4097caaad3 100644 --- a/core/codegen/javagen/src/test/resources/specifications/MathLib.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/MathLib.vdmpp.result @@ -11,24 +11,24 @@ public class A { } public void op() { - Number x0 = MATH.sin(x); - Number x1 = MATH.cos(x); - Number x2 = MATH.tan(x); - Number x3 = MATH.cot(x); - Number x4 = MATH.asin(x); - Number x5 = MATH.acos(x); - Number x6 = MATH.atan(x); - Number x7 = MATH.acot(x); - Number x8 = MATH.sqrt(x); + Number x0 = MATH.sin(A.x); + Number x1 = MATH.cos(A.x); + Number x2 = MATH.tan(A.x); + Number x3 = MATH.cot(A.x); + Number x4 = MATH.asin(A.x); + Number x5 = MATH.acos(A.x); + Number x6 = MATH.atan(A.x); + Number x7 = MATH.acot(A.x); + Number x8 = MATH.sqrt(A.x); Number x9 = MATH.pi_f(); - Number x10 = MATH.rand(x); - Number x11 = MATH.srand2(x); - Number x12 = MATH.exp(x); - Number x13 = MATH.ln(x); - Number x14 = MATH.log(x); - Number x15 = MATH.fac(x); + Number x10 = MATH.rand(A.x); + Number x11 = MATH.srand2(A.x); + Number x12 = MATH.exp(A.x); + Number x13 = MATH.ln(A.x); + Number x14 = MATH.log(A.x); + Number x15 = MATH.fac(A.x); Number x16 = MATH.pi; - MATH.srand(x); + MATH.srand(A.x); } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/specifications/RecordNesting.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/RecordNesting.vdmpp.result index e28e373c4f..d8a8d3cf4c 100644 --- a/core/codegen/javagen/src/test/resources/specifications/RecordNesting.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/RecordNesting.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final R3 x = new R3(1L, new R2(new R1(2L))); - private static final R3 y = Utils.copy(x); + private static final R3 y = Utils.copy(A.x); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/RecordUsage.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/RecordUsage.vdmpp.result index 53c6c3d12c..b81ee7ec41 100644 --- a/core/codegen/javagen/src/test/resources/specifications/RecordUsage.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/RecordUsage.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final R2 a = new R2(new R1(2L), 3L); - private static final R2 b = Utils.copy(a); + private static final R2 b = Utils.copy(A.a); private static final R1 c = Utils.copy(a.r1); private static final Number d = a.r1.x; diff --git a/core/codegen/javagen/src/test/resources/specifications/SeqModCloning.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SeqModCloning.vdmpp.result index 25c0c71a8c..ec2b8e7e51 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SeqModCloning.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SeqModCloning.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSeq a = SeqUtil.seq(1L, 2L); - private static final VDMSeq b = SeqUtil.mod(Utils.copy(a), + private static final VDMSeq b = SeqUtil.mod(Utils.copy(A.a), MapUtil.map(new Maplet(1L, 5L))); public A() { diff --git a/core/codegen/javagen/src/test/resources/specifications/SeqReverseBasicTypes.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SeqReverseBasicTypes.vdmpp.result index f1536682fd..17a5572877 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SeqReverseBasicTypes.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SeqReverseBasicTypes.vdmpp.result @@ -17,17 +17,17 @@ public class A { } public void op() { - VDMSeq as_ = SeqUtil.reverse(Utils.copy(as)); + VDMSeq as_ = SeqUtil.reverse(Utils.copy(A.as)); - VDMSeq bs_ = SeqUtil.reverse(Utils.copy(bs)); + VDMSeq bs_ = SeqUtil.reverse(Utils.copy(A.bs)); - VDMSeq cs_ = SeqUtil.reverse(Utils.copy(cs)); + VDMSeq cs_ = SeqUtil.reverse(Utils.copy(A.cs)); - VDMSeq ds_ = SeqUtil.reverse(Utils.copy(ds)); + VDMSeq ds_ = SeqUtil.reverse(Utils.copy(A.ds)); - VDMSeq es_ = SeqUtil.reverse(Utils.copy(es)); + VDMSeq es_ = SeqUtil.reverse(Utils.copy(A.es)); - VDMSeq fs_ = SeqUtil.reverse(Utils.copy(fs)); + VDMSeq fs_ = SeqUtil.reverse(Utils.copy(A.fs)); /* skip */ } diff --git a/core/codegen/javagen/src/test/resources/specifications/SetDiffClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SetDiffClone.vdmpp.result index 86212d63a5..a6ba019629 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SetDiffClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SetDiffClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L, 3L); - private static final VDMSet x = SetUtil.diff(Utils.copy(a), op()); + private static final VDMSet x = SetUtil.diff(Utils.copy(A.a), op()); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/SetDistInterClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SetDistInterClone.vdmpp.result index e0a0c3c20f..fc4d053151 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SetDistInterClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SetDistInterClone.vdmpp.result @@ -6,8 +6,8 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L, 3L); - private static final VDMSet b = SetUtil.dinter(SetUtil.set(Utils.copy(a), - Utils.copy(a), Utils.copy(a))); + private static final VDMSet b = SetUtil.dinter(SetUtil.set(Utils.copy(A.a), + Utils.copy(A.a), Utils.copy(A.a))); private static final VDMSet c = SetUtil.dinter(op()); public A() { diff --git a/core/codegen/javagen/src/test/resources/specifications/SetDistUnionClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SetDistUnionClone.vdmpp.result index 88f50cdb02..6e7c04bc09 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SetDistUnionClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SetDistUnionClone.vdmpp.result @@ -6,8 +6,8 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L, 3L); - private static final VDMSet b = SetUtil.dunion(SetUtil.set(Utils.copy(a), - Utils.copy(a), Utils.copy(a))); + private static final VDMSet b = SetUtil.dunion(SetUtil.set(Utils.copy(A.a), + Utils.copy(A.a), Utils.copy(A.a))); private static final VDMSet c = SetUtil.dunion(op()); public A() { diff --git a/core/codegen/javagen/src/test/resources/specifications/SetIntersectClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SetIntersectClone.vdmpp.result index f5d83aa395..43dc93d11f 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SetIntersectClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SetIntersectClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L, 3L); - private static final VDMSet x = SetUtil.intersect(Utils.copy(a), op()); + private static final VDMSet x = SetUtil.intersect(Utils.copy(A.a), op()); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/SetPowerSetClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SetPowerSetClone.vdmpp.result index 17bb2ff60a..3f0956a6d8 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SetPowerSetClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SetPowerSetClone.vdmpp.result @@ -6,8 +6,8 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L, 3L); - private static final VDMSet b = SetUtil.powerset(SetUtil.set(Utils.copy(a), - Utils.copy(a), Utils.copy(a))); + private static final VDMSet b = SetUtil.powerset(SetUtil.set(Utils.copy(A.a), + Utils.copy(A.a), Utils.copy(A.a))); private static final VDMSet c = SetUtil.powerset(op()); public A() { diff --git a/core/codegen/javagen/src/test/resources/specifications/SetProperSubsetClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SetProperSubsetClone.vdmpp.result index 32f2bb720b..f92cb86b6c 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SetProperSubsetClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SetProperSubsetClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L, 3L); - private static final Boolean x = SetUtil.psubset(a, op()); + private static final Boolean x = SetUtil.psubset(A.a, op()); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/SetSubsetClone.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SetSubsetClone.vdmpp.result index 35dc41a610..7732b18e79 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SetSubsetClone.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SetSubsetClone.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L, 3L); - private static final Boolean x = SetUtil.subset(a, op()); + private static final Boolean x = SetUtil.subset(A.a, op()); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/SetUnionCloning.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/SetUnionCloning.vdmpp.result index cbe93bd741..f0a1e0bb5d 100644 --- a/core/codegen/javagen/src/test/resources/specifications/SetUnionCloning.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/SetUnionCloning.vdmpp.result @@ -6,7 +6,8 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final VDMSet a = SetUtil.set(1L, 2L, 3L); - private static final VDMSet x = SetUtil.union(Utils.copy(a), Utils.copy(a)); + private static final VDMSet x = SetUtil.union(Utils.copy(A.a), + Utils.copy(A.a)); public A() { } diff --git a/core/codegen/javagen/src/test/resources/specifications/TupleUsage.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/TupleUsage.vdmpp.result index 7868f9a281..463bb4d097 100644 --- a/core/codegen/javagen/src/test/resources/specifications/TupleUsage.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/TupleUsage.vdmpp.result @@ -6,7 +6,7 @@ import java.util.*; @SuppressWarnings("all") public class A { private static final Tuple a = Tuple.mk_(Tuple.mk_(1L, true), 3L); - private static final Tuple b = Utils.copy(a); + private static final Tuple b = Utils.copy(A.a); private static final Tuple c = Utils.copy(((Tuple) a.get(0))); private static final Number d = ((Number) ((Tuple) a.get(0)).get(0)); private static final Boolean e = ((Boolean) ((Tuple) a.get(0)).get(1)); diff --git a/core/codegen/javagen/src/test/resources/specifications/VariableExpressions.vdmpp.result b/core/codegen/javagen/src/test/resources/specifications/VariableExpressions.vdmpp.result index f7b39f2f73..aebe9ceca4 100644 --- a/core/codegen/javagen/src/test/resources/specifications/VariableExpressions.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/specifications/VariableExpressions.vdmpp.result @@ -15,8 +15,8 @@ public class A { } public Number o1() { - return f().longValue() + g(3L).longValue() + h(1L, 2L).longValue() + - op2(3L).longValue() + op2(3L).longValue(); + return A.f().longValue() + A.g(3L).longValue() + h(1L, 2L).longValue() + + op2(3L).longValue() + A.op2(3L).longValue(); } public static Number op2(final Number x) { diff --git a/core/codegen/javagen/src/test/resources/string_specs/Concat.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Concat.vdmpp.result index 107aef59b2..f231e08b9a 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Concat.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Concat.vdmpp.result @@ -11,7 +11,7 @@ public class Entry { } public static Object Run() { - return "a" + a + f(); + return "a" + Entry.a + f(); } public static String f() { diff --git a/core/codegen/javagen/src/test/resources/string_specs/Elems.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Elems.vdmpp.result index e3b6df5f27..0e28c5f5cb 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Elems.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Elems.vdmpp.result @@ -11,8 +11,8 @@ public class Entry { } public static Object Run() { - return SetUtil.union(SetUtil.union(SeqUtil.elems("a"), SeqUtil.elems(a)), - SeqUtil.elems(f())); + return SetUtil.union(SetUtil.union(SeqUtil.elems("a"), + SeqUtil.elems(Entry.a)), SeqUtil.elems(f())); } public static String f() { diff --git a/core/codegen/javagen/src/test/resources/string_specs/Head.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Head.vdmpp.result index 84e8dddee5..d13beac56c 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Head.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Head.vdmpp.result @@ -12,7 +12,7 @@ public class Entry { public static Object Run() { return new String(new char[] { "a".charAt(0) }) + - new String(new char[] { a.charAt(0) }) + + new String(new char[] { Entry.a.charAt(0) }) + new String(new char[] { f().charAt(0) }); } diff --git a/core/codegen/javagen/src/test/resources/string_specs/Indexing.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Indexing.vdmpp.result index b6b74d9591..96efa8b869 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Indexing.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Indexing.vdmpp.result @@ -11,7 +11,7 @@ public class Entry { } public static Object Run() { - return a + s() + f(); + return Entry.a + s() + f(); } public static String s() { diff --git a/core/codegen/javagen/src/test/resources/string_specs/Indices.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Indices.vdmpp.result index 7a4fdfed8f..a18f3f280f 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Indices.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Indices.vdmpp.result @@ -11,7 +11,8 @@ public class Entry { } public static Object Run() { - return SeqUtil.seq(SeqUtil.inds("a"), SeqUtil.inds(a), SeqUtil.inds(f())); + return SeqUtil.seq(SeqUtil.inds("a"), SeqUtil.inds(Entry.a), + SeqUtil.inds(f())); } public static String f() { diff --git a/core/codegen/javagen/src/test/resources/string_specs/Modification.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Modification.vdmpp.result index 88cbd87a59..a00ceade3b 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Modification.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Modification.vdmpp.result @@ -12,7 +12,8 @@ public class Entry { public static Object Run() { return SeqUtil.mod("a", MapUtil.map(new Maplet(1L, 'b'))) + - SeqUtil.mod(a, MapUtil.map(new Maplet(1L, 'm'), new Maplet(3L, 'l'))) + + SeqUtil.mod(Entry.a, + MapUtil.map(new Maplet(1L, 'm'), new Maplet(3L, 'l'))) + SeqUtil.mod(f(), MapUtil.map(new Maplet(1L, 'b'))); } diff --git a/core/codegen/javagen/src/test/resources/string_specs/Reverse.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Reverse.vdmpp.result index 4860087846..b155ec2c56 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Reverse.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Reverse.vdmpp.result @@ -12,7 +12,7 @@ public class Entry { public static Object Run() { return new StringBuilder("jeh").reverse().toString() + - new StringBuilder(a).reverse().toString(); + new StringBuilder(Entry.a).reverse().toString(); } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp.result index 79770353f3..21c54c839e 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/SeqConversion.vdmpp.result @@ -67,8 +67,8 @@ public class Entry { } public static String Run() { - return SeqUtil.toStr(Utils.copy(x)) + f() + op1() + op2() + op3() + - op5() + SeqUtil.toStr(op6()) + op7() + + return SeqUtil.toStr(Utils.copy(Entry.x)) + f() + op1() + op2() + + op3() + op5() + SeqUtil.toStr(op6()) + op7() + op8(quotes.AQuote.getInstance()); } diff --git a/core/codegen/javagen/src/test/resources/string_specs/Size.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Size.vdmpp.result index d2708bb9fe..a819177b4e 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Size.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Size.vdmpp.result @@ -11,7 +11,7 @@ public class Entry { } public static Object Run() { - return "a".length() + a.length() + f().length(); + return "a".length() + Entry.a.length() + f().length(); } public static String f() { diff --git a/core/codegen/javagen/src/test/resources/string_specs/Tail.vdmpp.result b/core/codegen/javagen/src/test/resources/string_specs/Tail.vdmpp.result index 572c761eba..9536ba1d17 100644 --- a/core/codegen/javagen/src/test/resources/string_specs/Tail.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/string_specs/Tail.vdmpp.result @@ -11,7 +11,7 @@ public class Entry { } public static Object Run() { - return SeqUtil.tail("a") + SeqUtil.tail(a) + SeqUtil.tail(f()); + return SeqUtil.tail("a") + SeqUtil.tail(Entry.a) + SeqUtil.tail(f()); } public static String f() { diff --git a/core/codegen/javagen/src/test/resources/traces_expansion_specs/LetBeStRecPattern.vdmpp.result b/core/codegen/javagen/src/test/resources/traces_expansion_specs/LetBeStRecPattern.vdmpp.result index af8ffb636f..627f402c7d 100644 --- a/core/codegen/javagen/src/test/resources/traces_expansion_specs/LetBeStRecPattern.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/traces_expansion_specs/LetBeStRecPattern.vdmpp.result @@ -21,7 +21,7 @@ public class Entry implements java.io.Serializable { final IdGenerator gen = new IdGenerator(); SequenceTraceNode sequence_1 = new SequenceTraceNode(); AlternativeTraceNode alternatives_2 = new AlternativeTraceNode(); - VDMSet set_1 = Utils.copy(xs); + VDMSet set_1 = Utils.copy(Entry.xs); for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { final Object recordPattern_1 = ((Object) iterator_1.next()); diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/CallObjStmWithArguments.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/CallObjStmWithArguments.vdmpp.result index a75e242273..3930789956 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/CallObjStmWithArguments.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/CallObjStmWithArguments.vdmpp.result @@ -114,7 +114,7 @@ public class Entry { } } - return c; + return Entry.c; } } diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpArgToOpCall.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpArgToOpCall.vdmpp.result index bd7561386c..b4ff6c93fe 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpArgToOpCall.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpArgToOpCall.vdmpp.result @@ -52,7 +52,7 @@ public class Entry { public static Object Run() { Number sum = 0L; - long toVar_1 = hr.size(); + long toVar_1 = Entry.hr.size(); for (Long i = 1L; i <= toVar_1; i++) { Object obj_1 = Utils.get(hr, i); diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpInReturnStm.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpInReturnStm.vdmpp.result index 0ce068dbd8..66a74826c5 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpInReturnStm.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpInReturnStm.vdmpp.result @@ -47,7 +47,7 @@ public class Entry { } public static Object Run() { - Object obj_1 = Utils.get(hr, hr.size()); + Object obj_1 = Utils.get(hr, Entry.hr.size()); Number apply_1 = null; diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result index 9cb2982beb..82554126d9 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpNotRootOfApplyExp.vdmpp.result @@ -44,7 +44,8 @@ public class Entry { mapCompResult_1 = MapUtil.munion(Utils.copy(mapCompResult_1), MapUtil.map( - new Maplet(Utils.copy(hr), S(Utils.copy(apply_1))))); + new Maplet(Utils.copy(hr), + Entry.S(Utils.copy(apply_1))))); } ternaryIfExp_2 = Utils.copy(mapCompResult_1); diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpWithObjectAsApplyExp.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpWithObjectAsApplyExp.vdmpp.result index d8b9815760..a247bc3f34 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpWithObjectAsApplyExp.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/FieldExpWithObjectAsApplyExp.vdmpp.result @@ -26,7 +26,7 @@ public class Entry { VDMSeq ss = Utils.copy(ternaryIfExp_1); VDMSeq s = Utils.copy(((VDMSeq) Utils.get(ss, 1L))); - Number y = S(((Entry) Utils.get(s, s.size()))).x; + Number y = Entry.S(((Entry) Utils.get(s, s.size()))).x; return y; } diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/IfStm.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/IfStm.vdmpp.result index 21a45bd6bf..434a68c5bf 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/IfStm.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/IfStm.vdmpp.result @@ -11,11 +11,11 @@ public class Entry { } public static Object Run() { - if (!(((Boolean) x))) { + if (!(((Boolean) Entry.x))) { return 1L; - } else if (((Boolean) x)) { + } else if (((Boolean) Entry.x)) { return 2L; - } else if (((Boolean) x)) { + } else if (((Boolean) Entry.x)) { return 3L; } else { return 4L; diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/LetBeStRecElem.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/LetBeStRecElem.vdmpp.result index a03ecbf5ab..5eb0889267 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/LetBeStRecElem.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/LetBeStRecElem.vdmpp.result @@ -13,7 +13,7 @@ public class Entry { public static Object Run() { Object r = null; Boolean success_1 = false; - VDMSet set_1 = Utils.copy(xs); + VDMSet set_1 = Utils.copy(Entry.xs); for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext() && !(success_1);) { diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/MapApply.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/MapApply.vdmpp.result index 8024841cf2..1377154409 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/MapApply.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/MapApply.vdmpp.result @@ -14,7 +14,7 @@ public class Entry { } public static Object Run() { - return b; + return Entry.b; } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/MapCompUnionOfMapTypes.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/MapCompUnionOfMapTypes.vdmpp.result index 83db2b3caa..b18bb8cada 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/MapCompUnionOfMapTypes.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/MapCompUnionOfMapTypes.vdmpp.result @@ -13,7 +13,7 @@ public class Entry { public static Object Run() { VDMMap mapCompResult_1 = MapUtil.map(); - VDMSet set_1 = MapUtil.dom(Utils.copy(xs)); + VDMSet set_1 = MapUtil.dom(Utils.copy(Entry.xs)); for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { Object e = ((Object) iterator_1.next()); diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/NotExp.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/NotExp.vdmpp.result index 41503a610f..9466fca619 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/NotExp.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/NotExp.vdmpp.result @@ -11,7 +11,7 @@ public class Entry { } public static Object Run() { - return !(((Boolean) x)); + return !(((Boolean) Entry.x)); } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/NumericPlus.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/NumericPlus.vdmpp.result index 9c68a3c74e..f33a87190a 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/NumericPlus.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/NumericPlus.vdmpp.result @@ -13,8 +13,8 @@ public class Entry { } public static Object Run() { - return ((Number) a).doubleValue() + ((Number) b).doubleValue() + - ((Number) c).doubleValue(); + return ((Number) Entry.a).doubleValue() + + ((Number) Entry.b).doubleValue() + ((Number) Entry.c).doubleValue(); } public String toString() { diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/SeqCompUnionOfSeqTypes.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/SeqCompUnionOfSeqTypes.vdmpp.result index 93464ad6a6..eb6315a072 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/SeqCompUnionOfSeqTypes.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/SeqCompUnionOfSeqTypes.vdmpp.result @@ -12,7 +12,7 @@ public class Entry { public static Object Run() { VDMSeq seqCompResult_1 = SeqUtil.seq(); - VDMSet set_1 = SeqUtil.elems(Utils.copy(xs)); + VDMSet set_1 = SeqUtil.elems(Utils.copy(Entry.xs)); for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { Object e = ((Object) iterator_1.next()); diff --git a/core/codegen/javagen/src/test/resources/union_type_specs/SetCompUnionOfSetTypes.vdmpp.result b/core/codegen/javagen/src/test/resources/union_type_specs/SetCompUnionOfSetTypes.vdmpp.result index 432359fd89..ee490aa460 100644 --- a/core/codegen/javagen/src/test/resources/union_type_specs/SetCompUnionOfSetTypes.vdmpp.result +++ b/core/codegen/javagen/src/test/resources/union_type_specs/SetCompUnionOfSetTypes.vdmpp.result @@ -12,7 +12,7 @@ public class Entry { public static Object Run() { VDMSet setCompResult_1 = SetUtil.set(); - VDMSet set_1 = Utils.copy(xs); + VDMSet set_1 = Utils.copy(Entry.xs); for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { Object e = ((Object) iterator_1.next()); From a73e075664dddfc2ab042910bc60bcac90689f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 16 Oct 2015 20:29:32 +0200 Subject: [PATCH 173/706] Two fixes related to IR construction of variable expressions - Now the namescope of the variable definition is used to determine if it is local or not - Changed criterion for construction of explicit variables --- .../codegen/visitor/ExpVisitorCG.java | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java index 62a774ea71..098b9e2e6e 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java @@ -25,11 +25,9 @@ import java.util.List; import org.overture.ast.analysis.AnalysisException; -import org.overture.ast.definitions.AAssignmentDefinition; import org.overture.ast.definitions.AClassClassDefinition; import org.overture.ast.definitions.AInheritedDefinition; import org.overture.ast.definitions.AInstanceVariableDefinition; -import org.overture.ast.definitions.ALocalDefinition; import org.overture.ast.definitions.AStateDefinition; import org.overture.ast.definitions.PDefinition; import org.overture.ast.definitions.SClassDefinition; @@ -45,6 +43,7 @@ import org.overture.ast.patterns.PBind; import org.overture.ast.patterns.PMultipleBind; import org.overture.ast.patterns.PPattern; +import org.overture.ast.typechecker.NameScope; import org.overture.ast.types.AClassType; import org.overture.ast.types.ARecordInvariantType; import org.overture.ast.types.ASetType; @@ -1309,21 +1308,14 @@ public SExpCG caseAVariableExp(AVariableExp node, IRInfo question) SClassDefinition owningClass = varDef.getAncestor(SClassDefinition.class); SClassDefinition nodeParentClass = node.getAncestor(SClassDefinition.class); - boolean inOwningClass = owningClass == nodeParentClass; - - boolean isLocalDef = varDef instanceof ALocalDefinition; + boolean isLocalDef = varDef.getNameScope() == NameScope.LOCAL; boolean isInstanceVarDef = varDef instanceof AInstanceVariableDefinition; boolean isExplOp = varDef instanceof SOperationDefinition; boolean isExplFunc = varDef instanceof SFunctionDefinition; - boolean isAssignmentDef = varDef instanceof AAssignmentDefinition; - boolean isDefInOwningClass = inOwningClass - && (isLocalDef || isInstanceVarDef || isExplOp || isExplFunc || isAssignmentDef); + boolean isDefInOwningClass = owningClass == nodeParentClass + && (isLocalDef || isInstanceVarDef || isExplOp || isExplFunc); - boolean isImplicit = !explicit; - - boolean isInheritedDef = varDef instanceof AInheritedDefinition; - if(isExplOp && !isDefInOwningClass && !question.getTcFactory().createPDefinitionAssistant().isStatic(varDef)) { ASuperVarExpCG superVarExp = new ASuperVarExpCG(); @@ -1335,22 +1327,12 @@ public SExpCG caseAVariableExp(AVariableExp node, IRInfo question) return superVarExp; } - else if (owningClass == null - || nodeParentClass == null - || isDefInOwningClass - || isInheritedDef - || isImplicit - || explicit - && !question.getTcFactory().createPDefinitionAssistant().isStatic(varDef)) - { - return consIdVar(name, isLambda, typeCg, isLocalDef); - } else if (explicit) + else if (explicit && !isLocalDef && question.getTcFactory().createPDefinitionAssistant().isStatic(varDef)) { return consExplicitVar(node.getName().getModule(), name, isLambda, typeCg, isLocalDef); } else { - question.addUnsupportedNode(node, "Reached unexpected case when generating a variable expression in a PP model in '" + this.getClass().getSimpleName() + "'"); - return null; + return consIdVar(name, isLambda, typeCg, isLocalDef); } } else if(Settings.dialect == Dialect.VDM_SL) From f9b7cea6b65b1b7d53c5da174c87d2d91a227e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Fri, 16 Oct 2015 21:04:53 +0200 Subject: [PATCH 174/706] Take 'module' of 'LexNameToken' into account when normalising identifiers --- .../vdm2java/JavaIdentifierNormaliser.java | 22 ++++++++++++--- .../codegen/analysis/vdm/RenameAnalysis.java | 6 ++-- .../codegen/analysis/vdm/Renaming.java | 28 +++++++++++++------ .../vdm/VarShadowingRenameCollector.java | 2 +- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaIdentifierNormaliser.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaIdentifierNormaliser.java index 73157cd640..9a88e89be9 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaIdentifierNormaliser.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaIdentifierNormaliser.java @@ -37,13 +37,27 @@ public void inILexNameToken(ILexNameToken node) throws AnalysisException return; } - if(!JavaCodeGenUtil.isValidJavaIdentifier(node.getName())) + if (!contains(node.getLocation())) { - String newName = getReplacementName(node.getName()); + boolean rename = false; + String newName = node.getName(); - if (!contains(node.getLocation())) + if (!JavaCodeGenUtil.isValidJavaIdentifier(node.getName())) { - this.renamings.add(new Renaming(node.getLocation(), node.getName(), newName)); + newName = getReplacementName(node.getName()); + rename = true; + } + + String newModule = node.getModule(); + if (!JavaCodeGenUtil.isValidJavaIdentifier(node.getModule())) + { + newModule = getReplacementName(node.getModule()); + rename = true; + } + + if(rename) + { + this.renamings.add(new Renaming(node.getLocation(), node.getName(), newName, node.getModule(), newModule)); } } } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/RenameAnalysis.java b/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/RenameAnalysis.java index aaf15d4eac..3ceb1f31ae 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/RenameAnalysis.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/RenameAnalysis.java @@ -42,16 +42,16 @@ private void handleNameToken(INode parent, ILexNameToken node) { if (node.getLocation().equals(r.getLoc())) { - parent.replaceChild(node, consLexNameToken(node, r.getNewName())); + parent.replaceChild(node, consLexNameToken(node, r.getNewName(), r.getNewModule())); break; } } } private LexNameToken consLexNameToken(ILexNameToken defName, - String newName) + String newName, String newModule) { - LexNameToken newLexName = new LexNameToken(defName.getModule(), newName, defName.getLocation(), defName.getOld(), defName.getExplicit()); + LexNameToken newLexName = new LexNameToken(newModule, newName, defName.getLocation(), defName.getOld(), defName.getExplicit()); newLexName.setTypeQualifier(defName.getTypeQualifier()); return newLexName; diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/Renaming.java b/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/Renaming.java index cc8fbcd94d..41674acd30 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/Renaming.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/Renaming.java @@ -5,29 +5,31 @@ public class Renaming implements Comparable { private ILexLocation loc; + private String oldName; private String newName; - public Renaming(ILexLocation loc, String oldName, String newName) + private String oldModule; + private String newModule; + + public Renaming(ILexLocation loc, String oldName, String newName, String oldModule, String newModule) { if(loc == null) { throw new IllegalArgumentException("Location cannot be null in Renaming"); } - if(oldName == null || oldName.isEmpty()) - { - throw new IllegalArgumentException("The old name of a renaming cannot be null or the empty String"); - } - - if(newName == null || newName.isEmpty()) + if (oldName == null || oldName.isEmpty() || newName == null || newName.isEmpty() || oldModule == null + || oldModule.isEmpty() || newModule == null || newModule.isEmpty()) { - throw new IllegalArgumentException("The new name of a renaming cannot be null or the empty String"); + throw new IllegalArgumentException("Input names cannot 'null' or empty strings"); } this.loc = loc; this.oldName = oldName; this.newName = newName; + this.oldModule = oldModule; + this.newModule = newModule; } public ILexLocation getLoc() @@ -45,6 +47,16 @@ public String getNewName() return newName; } + public String getOldModule() + { + return oldModule; + } + + public String getNewModule() + { + return newModule; + } + @Override public String toString() { diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/VarShadowingRenameCollector.java b/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/VarShadowingRenameCollector.java index ee28483848..d4adafee8c 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/VarShadowingRenameCollector.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/VarShadowingRenameCollector.java @@ -1024,7 +1024,7 @@ private void registerRenaming(ILexNameToken name, String newName) { if (!contains(name.getLocation())) { - renamings.add(new Renaming(name.getLocation(), name.getName(), newName)); + renamings.add(new Renaming(name.getLocation(), name.getName(), newName, name.getModule(), name.getModule())); } } From 383be796096b4351c9be561f3088f1cccfbf173d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 11:04:31 +0200 Subject: [PATCH 175/706] Add more tests to exercise JML generation of set types --- .../settype/SetEvenNamedTypeInv/Entry.java | 66 +++++++++++++++++++ .../SetEvenNamedTypeInv.vdmsl | 31 +++++++++ .../SetEvenNamedTypeInv.vdmsl.result | 7 ++ .../settype/SetPassNill/Entry.java | 57 ++++++++++++++++ .../settype/SetPassNill/SetPassNil.vdmsl | 31 +++++++++ .../SetPassNill/SetPassNil.vdmsl.result | 13 ++++ 6 files changed, 205 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java new file mode 100644 index 0000000000..8343cd959b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java @@ -0,0 +1,66 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMSet ignorePattern_1 = SetUtil.set(2L, 4L, 6L); + + //@ assert ((V2J.isSet(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); (Utils.is_nat(V2J.get(ignorePattern_1,i)) && inv_Entry_Even(V2J.get(ignorePattern_1,i))))) && inv_Entry_SetEven(ignorePattern_1)); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMSet xs = SetUtil.set(2L); + + //@ assert ((V2J.isSet(xs) && (\forall int i; 0 <= i && i < V2J.size(xs); (Utils.is_nat(V2J.get(xs,i)) && inv_Entry_Even(V2J.get(xs,i))))) && inv_Entry_SetEven(xs)); + VDMSet ys = SetUtil.set(1L); + + //@ assert (V2J.isSet(ys) && (\forall int i; 0 <= i && i < V2J.size(ys); Utils.is_nat(V2J.get(ys,i)))); + VDMSet ignorePattern_2 = SetUtil.union(Utils.copy(xs), + Utils.copy(ys)); + + //@ assert ((V2J.isSet(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); (Utils.is_nat(V2J.get(ignorePattern_2,i)) && inv_Entry_Even(V2J.get(ignorePattern_2,i))))) && inv_Entry_SetEven(ignorePattern_2)); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + public String toString() { + return "Entry{}"; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_SetEven(final Object check_elem) { + return true; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_Even(final Object check_e) { + Number e = ((Number) check_e); + + return Utils.equals(Utils.mod(e.longValue(), 2L), 0L); + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl new file mode 100644 index 0000000000..72bc0fc752 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl @@ -0,0 +1,31 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +SetEven = set of Even; +Even = nat +inv e == e mod 2 = 0; + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : SetEven = {2, 4, 6} in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let xs : SetEven = {2}, + ys : set of nat = {1}, + - : SetEven = xs union ys + in + skip; + IO`println("After illegal use"); + return 0; +); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl.result new file mode 100644 index 0000000000..222264febd --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:39: JML assertion is false + //@ assert ((V2J.isSet(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); (Utils.is_nat(V2J.get(ignorePattern_2,i)) && inv_Entry_Even(V2J.get(ignorePattern_2,i))))) && inv_Entry_SetEven(ignorePattern_2)); + ^ +"After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/Entry.java new file mode 100644 index 0000000000..815376989a --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/Entry.java @@ -0,0 +1,57 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMSet r = idSet(SetUtil.set(true, false)); + + //@ assert (V2J.isSet(r) && (\forall int i; 0 <= i && i < V2J.size(r); Utils.is_bool(V2J.get(r,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMSet xs = null; + + //@ assert ((xs == null) || (V2J.isSet(xs) && (\forall int i; 0 <= i && i < V2J.size(xs); Utils.is_bool(V2J.get(xs,i))))); + VDMSet r = idSet(Utils.copy(xs)); + + //@ assert (V2J.isSet(r) && (\forall int i; 0 <= i && i < V2J.size(r); Utils.is_bool(V2J.get(r,i)))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static VDMSet idSet(final VDMSet xs) { + //@ assert (V2J.isSet(xs) && (\forall int i; 0 <= i && i < V2J.size(xs); Utils.is_bool(V2J.get(xs,i)))); + VDMSet ret_1 = Utils.copy(xs); + + //@ assert (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_bool(V2J.get(ret_1,i)))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl new file mode 100644 index 0000000000..18abfa8cc6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl @@ -0,0 +1,31 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + (dcl r : set of bool := idSet({true, false}); skip); + IO`println("After legal use"); + IO`println("Before illegal use"); + ( + dcl xs : [set of bool] := nil; + dcl r : set of bool := idSet(xs); + skip; + ); + IO`println("After illegal use"); + return 0; +); + +functions + +idSet : set of bool -> set of bool +idSet (xs) == + xs; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl.result new file mode 100644 index 0000000000..81759baac2 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl.result @@ -0,0 +1,13 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:47: JML assertion is false + //@ assert (V2J.isSet(xs) && (\forall int i; 0 <= i && i < V2J.size(xs); Utils.is_bool(V2J.get(xs,i)))); + ^ +Entry.java:50: JML assertion is false + //@ assert (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_bool(V2J.get(ret_1,i)))); + ^ +Entry.java:35: JML assertion is false + //@ assert (V2J.isSet(r) && (\forall int i; 0 <= i && i < V2J.size(r); Utils.is_bool(V2J.get(r,i)))); + ^ +"After illegal use" \ No newline at end of file From e20559f2119579b1fdf5653f4cbb6c1d129ba9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 11:48:58 +0200 Subject: [PATCH 176/706] Refactoring of set/seq related functionality --- .../predgen/info/AbstractCollectionInfo.java | 16 +++++-------- .../predgen/info/AbstractSetSeqInfo.java | 24 +++++++++++++++++++ .../codegen/vdm2jml/predgen/info/SeqInfo.java | 3 ++- .../codegen/vdm2jml/predgen/info/SetInfo.java | 3 ++- .../overture/vdm2jml/tests/V2JCallTests.java | 6 ++--- 5 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java index 0db56b5cac..f704ba4f63 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java @@ -9,18 +9,14 @@ public abstract class AbstractCollectionInfo extends AbstractTypeInfo { - public static final String GET_METHOD = "get"; public static final String ITE_VAR_NAME_PREFIX = "i"; public static final String SIZE__METHOD = "size"; - protected AbstractTypeInfo elementType; - - public AbstractCollectionInfo(boolean optional, AbstractTypeInfo elementType) + public AbstractCollectionInfo(boolean optional) { super(optional); - this.elementType = elementType; } - + @Override public boolean allowsNull() { @@ -32,17 +28,18 @@ public List getLeafTypesRecursively() { return new LinkedList<>(); } + + abstract public String consElementCheck(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen, String iteVar); abstract public String consCollectionCheck(String arg); - + @Override public String consCheckExp(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen) { String isColCheck = consCollectionCheck(arg); String sizeCall = consSubjectCheck(V2J.class.getSimpleName(), SIZE__METHOD, arg); String iteVar = nameGen.getName(ITE_VAR_NAME_PREFIX); - String elementArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_METHOD, arg, iteVar); - String elementCheck = elementType.consCheckExp(enclosingClass, javaRootPackage, elementArg, nameGen); + String elementCheck = consElementCheck(enclosingClass, javaRootPackage, arg, nameGen, iteVar); StringBuilder sb = new StringBuilder(); sb.append(isColCheck); @@ -54,7 +51,6 @@ public String consCheckExp(String enclosingClass, String javaRootPackage, String sb.append(elementCheck); sb.append(')'); - // (V2J.isSeq(seq) && (\forall int i; 0 <= i && i < V2JL.size(seq); Utils.is_nat(V2JL.get(seq,i)))); String seqCheckExp = "(" + sb.toString() + ")"; if(allowsNull()) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java new file mode 100644 index 0000000000..a8c0299e25 --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java @@ -0,0 +1,24 @@ +package org.overture.codegen.vdm2jml.predgen.info; + +import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.util.NameGen; + +public abstract class AbstractSetSeqInfo extends AbstractCollectionInfo +{ + public static final String GET_METHOD = "get"; + + protected AbstractTypeInfo elementType; + + public AbstractSetSeqInfo(boolean optional, AbstractTypeInfo elementType) + { + super(optional); + this.elementType = elementType; + } + + @Override + public String consElementCheck(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen, String iteVar) + { + String elementArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_METHOD, arg, iteVar); + return elementType.consCheckExp(enclosingClass, javaRootPackage, elementArg, nameGen); + } +} \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java index 09738ce872..21ba052f52 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java @@ -2,7 +2,7 @@ import org.overture.codegen.runtime.V2J; -public class SeqInfo extends AbstractCollectionInfo +public class SeqInfo extends AbstractSetSeqInfo { public static final String IS_SEQ_METHOD = "isSeq"; public static final String IS_SEQ1_METHOD = "isSeq1"; @@ -18,6 +18,7 @@ public SeqInfo(boolean optional, AbstractTypeInfo elementType, boolean isSeq1) @Override public String consCollectionCheck(String arg) { + //e.g. (V2J.isSeq(seq) && (\forall int i; 0 <= i && i < V2JL.size(seq); Utils.is_nat(V2JL.get(seq,i)))); return consSubjectCheck(V2J.class.getSimpleName(), isSeq1 ? IS_SEQ1_METHOD : IS_SEQ_METHOD, arg); } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java index 0a0814a121..493a6d7896 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java @@ -2,7 +2,7 @@ import org.overture.codegen.runtime.V2J; -public class SetInfo extends AbstractCollectionInfo +public class SetInfo extends AbstractSetSeqInfo { public static final String IS_SET_METHOD = "isSet"; @@ -14,6 +14,7 @@ public SetInfo(boolean optional, AbstractTypeInfo elementType) @Override public String consCollectionCheck(String arg) { + //e.g. (V2J.isSet(xs) && (\forall int i; 0 <= i && i < V2J.size(xs); Utils.is_nat(V2J.get(xs,i)))); return consSubjectCheck(V2J.class.getSimpleName(), IS_SET_METHOD, arg); } diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java index f2ff03f0f4..8744edf1b3 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java @@ -6,7 +6,7 @@ import org.junit.Assert; import org.junit.Test; import org.overture.codegen.runtime.V2J; -import org.overture.codegen.vdm2jml.predgen.info.AbstractCollectionInfo; +import org.overture.codegen.vdm2jml.predgen.info.AbstractSetSeqInfo; import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; import org.overture.codegen.vdm2jml.predgen.info.SetInfo; import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; @@ -34,13 +34,13 @@ public void checkTupField() @Test public void checkGetSeqElement() { - assertMethod(AbstractCollectionInfo.GET_METHOD, Object.class, int.class); + assertMethod(AbstractSetSeqInfo.GET_METHOD, Object.class, int.class); } @Test public void checkSeqSize() { - assertMethod(AbstractCollectionInfo.SIZE__METHOD, Object.class); + assertMethod(AbstractSetSeqInfo.SIZE__METHOD, Object.class); } @Test From 2b21b330f5153dc2e555533ffaeb69e9f4c943a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 12:50:55 +0200 Subject: [PATCH 177/706] Add support for checking of map types --- .../codegen/vdm2jml/predgen/TypePredUtil.java | 19 ++++++-- .../codegen/vdm2jml/predgen/info/MapInfo.java | 47 +++++++++++++++++++ .../info/NamedTypeInvDepCalculator.java | 15 ++++-- 3 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index dfdd9c08ab..86b698f66e 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -24,6 +24,7 @@ import org.overture.codegen.vdm2jml.data.RecClassInfo; import org.overture.codegen.vdm2jml.predgen.info.AbstractTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; +import org.overture.codegen.vdm2jml.predgen.info.MapInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInfo; import org.overture.codegen.vdm2jml.predgen.info.NamedTypeInvDepCalculator; import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; @@ -263,19 +264,27 @@ else if(type instanceof ASeqSeqTypeCG) ASeqSeqTypeCG seqType = ((ASeqSeqTypeCG) type); STypeCG elementType = seqType.getSeqOf(); - return new SeqInfo(assist.allowsNull(type), findTypeInfo(elementType), BooleanUtils.isTrue(seqType.getSeq1())); + return new SeqInfo(assist.allowsNull(seqType), findTypeInfo(elementType), BooleanUtils.isTrue(seqType.getSeq1())); } else if(type instanceof ASetSetTypeCG) { ASetSetTypeCG setType = (ASetSetTypeCG) type; STypeCG elementType = setType.getSetOf(); - return new SetInfo(assist.allowsNull(type), findTypeInfo(elementType)); + return new SetInfo(assist.allowsNull(setType), findTypeInfo(elementType)); } - else if(type instanceof AUnknownTypeCG || type instanceof ASetSetTypeCG || type instanceof AMapMapTypeCG) + else if(type instanceof AMapMapTypeCG) + { + AMapMapTypeCG mapType = (AMapMapTypeCG) type; + + AbstractTypeInfo domInfo = findTypeInfo(mapType.getFrom()); + AbstractTypeInfo rngInfo = findTypeInfo(mapType.getTo()); + + return new MapInfo(assist.allowsNull(mapType), domInfo, rngInfo); + + } + else if(type instanceof AUnknownTypeCG) { - // Can't do anything for these right now... - // TODO: implement handling return new UnknownLeaf(); } else diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java new file mode 100644 index 0000000000..a9a5d43b89 --- /dev/null +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java @@ -0,0 +1,47 @@ +package org.overture.codegen.vdm2jml.predgen.info; + +import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.util.NameGen; + +public class MapInfo extends AbstractCollectionInfo +{ + public static final String IS_MAP_METHOD = "isMap"; + public static final String GET_DOM_METHOD = "getDom"; + public static final String GET_RNG_METHOD = "getRng"; + + private AbstractTypeInfo domType; + private AbstractTypeInfo rngType; + + public MapInfo(boolean optional, AbstractTypeInfo domType, AbstractTypeInfo rngType) + { + super(optional); + this.domType = domType; + this.rngType = rngType; + } + + @Override + public String consElementCheck(String enclosingClass, String javaRootPackage, String arg, NameGen nameGen, + String iteVar) + { + String domArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_DOM_METHOD, arg, iteVar); + String rngArg = consSubjectCheckExtraArg(V2J.class.getSimpleName(), GET_RNG_METHOD, arg, iteVar); + + String domCheck = domType.consCheckExp(enclosingClass, javaRootPackage, domArg, nameGen); + String rngCheck = rngType.consCheckExp(enclosingClass, javaRootPackage, rngArg, nameGen); + + StringBuilder sb = new StringBuilder(); + sb.append(domCheck); + sb.append(JmlGenerator.JML_AND); + sb.append(rngCheck); + + return sb.toString(); + } + + @Override + public String consCollectionCheck(String arg) + { + //e.g. (V2J.isMap(m) && (\forall int i; 0 <= i && i < VDM2JML.size(m); Utils.is_nat(VDM2JML.getDom(i,m)) && Utils.is_nat(VDM2JML.getRng(i,m)))); + return consSubjectCheck(V2J.class.getSimpleName(), IS_MAP_METHOD, arg); + } +} diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index 9bea712958..5e34b8deb8 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -7,8 +7,7 @@ import org.overture.ast.analysis.AnalysisException; import org.overture.ast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.ast.types.ABracketType; -import org.overture.ast.types.AMapMapType; +import org.overture.ast.types.ABracketType; import org.overture.ast.types.ANamedInvariantType; import org.overture.ast.types.AOptionalType; import org.overture.ast.types.AProductType; @@ -17,6 +16,7 @@ import org.overture.ast.types.AUnionType; import org.overture.ast.types.AUnknownType; import org.overture.ast.types.PType; +import org.overture.ast.types.SMapTypeBase; import org.overture.ast.types.SSeqTypeBase; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.ir.IRInfo; @@ -170,7 +170,16 @@ else if(type instanceof ASetType) return new SetInfo(optional, create(info, setType.getSetof(), visited)); } - else if(type instanceof AUnknownType || type instanceof ASetType || type instanceof AMapMapType) + else if(type instanceof SMapTypeBase) + { + SMapTypeBase mapType = (SMapTypeBase) type; + + AbstractTypeInfo fromInfo = create(info, mapType.getFrom(), visited); + AbstractTypeInfo toInfo = create(info, mapType.getTo(), visited); + + return new MapInfo(optional, fromInfo, toInfo); + } + else if(type instanceof AUnknownType) { return new UnknownLeaf(); } From 6b4d003f99b41b03a363edf416c0cd6c31af9c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 12:51:31 +0200 Subject: [PATCH 178/706] Prepare testing of JML generation of map types --- .../tests/exec/JmlMapTypeExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlMapTypeExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlMapTypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlMapTypeExecTests.java new file mode 100644 index 0000000000..188a6b7827 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlMapTypeExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlMapTypeExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "maptype"; + + public static final String PROPERTY_ID = "maptype"; + + public JmlMapTypeExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From cfd0274084523c675661fbb6d25620f2ca8a5aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 12:53:57 +0200 Subject: [PATCH 179/706] First test to exercise handling of map types --- .../MapBoolToNatDetectNegInt/Entry.java | 54 +++++++++++++++++++ .../MapBoolToNatDetectNegInt.vdmsl | 26 +++++++++ .../MapBoolToNatDetectNegInt.vdmsl.result | 7 +++ 3 files changed, 87 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java new file mode 100644 index 0000000000..5e9a7964e6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java @@ -0,0 +1,54 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMMap ignorePattern_1 = MapUtil.map(new Maplet(false, 0L), + new Maplet(true, 1L)); + + //@ assert (V2J.isMap(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_bool(V2J.getDom(ignorePattern_1,i)) && Utils.is_nat(V2J.getRng(ignorePattern_1,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMMap ignorePattern_2 = mapBoolToInt(); + + //@ assert (V2J.isMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_bool(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static VDMMap mapBoolToInt() { + VDMMap ret_1 = MapUtil.map(new Maplet(false, 0L), new Maplet(true, -1L)); + + //@ assert (V2J.isMap(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_bool(V2J.getDom(ret_1,i)) && Utils.is_int(V2J.getRng(ret_1,i)))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl new file mode 100644 index 0000000000..d8dc6824a4 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl @@ -0,0 +1,26 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : map bool to nat = {false |-> 0, true |-> 1} in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : map bool to nat = mapBoolToInt() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +mapBoolToInt : () -> map bool to int +mapBoolToInt () == {false |-> 0, true |-> -1} + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl.result new file mode 100644 index 0000000000..30abf72aa8 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:33: JML assertion is false + //@ assert (V2J.isMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_bool(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); + ^ +"After illegal use" \ No newline at end of file From 954594972607dde23c874d9f62ff450057cae19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 13:24:32 +0200 Subject: [PATCH 180/706] Updates to test results related to checking of map types --- .../vdm2jml/tests/ModuleStateInvComplexTests.java | 2 +- .../overture/vdm2jml/tests/ModuleStateInvTests.java | 4 ++-- .../complexstatedes/ModifyRecInMap/A.java | 11 ++++++++++- .../complexstatedes/ModifyRecInMap/B.java | 6 +++--- .../complexstatedes/ModifyRecInMap/Entry.java | 4 ++++ .../ModifyRecInMap/ModifyRecInMap.vdmsl.result | 2 +- .../complexstatedes/RecWithMapOfRec/A.java | 11 ++++++++++- .../complexstatedes/RecWithMapOfRec/B.java | 6 +++--- .../RecWithMapOfRec/RecWithMapOfRec.vdmsl.result | 2 +- .../namedtypeinv/NamedTypeInvMapUpdate/Entry.java | 8 ++++---- .../NamedTypeInvMapUpdate.vdmsl.result | 2 +- 11 files changed, 40 insertions(+), 18 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java index 470a66ebee..156229899c 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvComplexTests.java @@ -24,7 +24,7 @@ public void seqField() public void mapField() throws org.overture.codegen.cgast.analysis.AnalysisException { - ModuleStateInvTests.checkAssertion("mapField", Update.SET_CALL, 4); + ModuleStateInvTests.checkAssertion("mapField", Update.SET_CALL, 5); } @Test diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java index 0612a7e9d4..4c695a5478 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/ModuleStateInvTests.java @@ -139,13 +139,13 @@ public void updateSeqElemAtomic() public void updateMapRng() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("assignM", Update.MAP_SEQ_UPDATE, 4); + checkAssertion("assignM", Update.MAP_SEQ_UPDATE, 5); } @Test public void updateMapRngAtomic() throws org.overture.codegen.cgast.analysis.AnalysisException { - checkAssertion("atomicAssignM", Update.MAP_SEQ_UPDATE, 4); + checkAssertion("atomicAssignM", Update.MAP_SEQ_UPDATE, 5); } } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java index 9976a5215c..906a4861ae 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java @@ -12,7 +12,10 @@ final public class A implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_A(m); public A(final VDMMap _m) { + //@ assert (V2J.isMap(_m) && (\forall int i; 0 <= i && i < V2J.size(_m); Utils.is_nat(V2J.getDom(_m,i)) && Utils.is_(V2J.getRng(_m,i),project.Entrytypes.B.class))); m = (_m != null) ? Utils.copy(_m) : null; + + //@ assert (V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); Utils.is_nat(V2J.getDom(m,i)) && Utils.is_(V2J.getRng(m,i),project.Entrytypes.B.class))); } /*@ pure @*/ @@ -43,11 +46,17 @@ public String toString() { /*@ pure @*/ public VDMMap get_m() { - return m; + VDMMap ret_3 = m; + + //@ assert project.Entry.invChecksOn ==> ((V2J.isMap(ret_3) && (\forall int i; 0 <= i && i < V2J.size(ret_3); Utils.is_nat(V2J.getDom(ret_3,i)) && Utils.is_(V2J.getRng(ret_3,i),project.Entrytypes.B.class)))); + return ret_3; } public void set_m(final VDMMap _m) { + //@ assert project.Entry.invChecksOn ==> ((V2J.isMap(_m) && (\forall int i; 0 <= i && i < V2J.size(_m); Utils.is_nat(V2J.getDom(_m,i)) && Utils.is_(V2J.getRng(_m,i),project.Entrytypes.B.class)))); m = _m; + + //@ assert project.Entry.invChecksOn ==> ((V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); Utils.is_nat(V2J.getDom(m,i)) && Utils.is_(V2J.getRng(m,i),project.Entrytypes.B.class)))); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java index d036d63a38..48ce915cfa 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java @@ -45,10 +45,10 @@ public String toString() { /*@ pure @*/ public Number get_x() { - Number ret_3 = x; + Number ret_4 = x; - //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_3)); - return ret_3; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_4)); + return ret_4; } public void set_x(final Number _x) { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java index 81ccd7aa71..3218493e31 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java @@ -52,6 +52,8 @@ public static Number useOk() { //@ assert stateDes_2 != null; stateDes_2.set_x(2L); + //@ assert (V2J.isMap(stateDes_1) && (\forall int i; 0 <= i && i < V2J.size(stateDes_1); Utils.is_nat(V2J.getDom(stateDes_1,i)) && Utils.is_(V2J.getRng(stateDes_1,i),project.Entrytypes.B.class))); + //@ assert Utils.is_(a,project.Entrytypes.A.class); //@ assert a.valid(); @@ -74,6 +76,8 @@ public static Number useNotOk() { //@ assert stateDes_4 != null; stateDes_4.set_x(1L); + //@ assert (V2J.isMap(stateDes_3) && (\forall int i; 0 <= i && i < V2J.size(stateDes_3); Utils.is_nat(V2J.getDom(stateDes_3,i)) && Utils.is_(V2J.getRng(stateDes_3,i),project.Entrytypes.B.class))); + //@ assert Utils.is_(a,project.Entrytypes.A.class); //@ assert a.valid(); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result index 85b789ce6c..4bb33c862b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:54: JML invariant is false on leaving method project.Entrytypes.A.valid() +A.java:63: JML invariant is false on leaving method project.Entrytypes.A.valid() public Boolean valid() { ^ A.java:13: Associated declaration diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java index 9976a5215c..906a4861ae 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java @@ -12,7 +12,10 @@ final public class A implements Record { //@ public instance invariant project.Entry.invChecksOn ==> inv_A(m); public A(final VDMMap _m) { + //@ assert (V2J.isMap(_m) && (\forall int i; 0 <= i && i < V2J.size(_m); Utils.is_nat(V2J.getDom(_m,i)) && Utils.is_(V2J.getRng(_m,i),project.Entrytypes.B.class))); m = (_m != null) ? Utils.copy(_m) : null; + + //@ assert (V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); Utils.is_nat(V2J.getDom(m,i)) && Utils.is_(V2J.getRng(m,i),project.Entrytypes.B.class))); } /*@ pure @*/ @@ -43,11 +46,17 @@ public String toString() { /*@ pure @*/ public VDMMap get_m() { - return m; + VDMMap ret_3 = m; + + //@ assert project.Entry.invChecksOn ==> ((V2J.isMap(ret_3) && (\forall int i; 0 <= i && i < V2J.size(ret_3); Utils.is_nat(V2J.getDom(ret_3,i)) && Utils.is_(V2J.getRng(ret_3,i),project.Entrytypes.B.class)))); + return ret_3; } public void set_m(final VDMMap _m) { + //@ assert project.Entry.invChecksOn ==> ((V2J.isMap(_m) && (\forall int i; 0 <= i && i < V2J.size(_m); Utils.is_nat(V2J.getDom(_m,i)) && Utils.is_(V2J.getRng(_m,i),project.Entrytypes.B.class)))); m = _m; + + //@ assert project.Entry.invChecksOn ==> ((V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); Utils.is_nat(V2J.getDom(m,i)) && Utils.is_(V2J.getRng(m,i),project.Entrytypes.B.class)))); } /*@ pure @*/ diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java index d036d63a38..48ce915cfa 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java @@ -45,10 +45,10 @@ public String toString() { /*@ pure @*/ public Number get_x() { - Number ret_3 = x; + Number ret_4 = x; - //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_3)); - return ret_3; + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_4)); + return ret_4; } public void set_x(final Number _x) { diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result index dd6fd80f50..b30dfb410a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:49: JML invariant is false on leaving method project.Entrytypes.A.set_m(org.overture.codegen.runtime.VDMMap) +A.java:55: JML invariant is false on leaving method project.Entrytypes.A.set_m(org.overture.codegen.runtime.VDMMap) public void set_m(final VDMMap _m) { ^ A.java:13: Associated declaration diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java index a57deb19d2..f51bbf2e30 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java @@ -14,20 +14,20 @@ private Entry() { public static Object Run() { VDMMap m = MapUtil.map(new Maplet('a', 1L), new Maplet(1L, 2L)); - //@ assert (true && inv_Entry_M(m)); + //@ assert ((V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); true && true)) && inv_Entry_M(m)); //@ assert m != null; Utils.mapSeqUpdate(m, 'a', 2L); - //@ assert (true && inv_Entry_M(m)); + //@ assert ((V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); true && true)) && inv_Entry_M(m)); //@ assert m != null; Utils.mapSeqUpdate(m, 1L, 2L); - //@ assert (true && inv_Entry_M(m)); + //@ assert ((V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); true && true)) && inv_Entry_M(m)); IO.println("Breaking named type invariant for sequence"); //@ assert m != null; Utils.mapSeqUpdate(m, 2L, 10L); - //@ assert (true && inv_Entry_M(m)); + //@ assert ((V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); true && true)) && inv_Entry_M(m)); return 0L; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result index 2a4bc25f1e..2ed81a853c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for sequence" Entry.java:30: JML assertion is false - //@ assert (true && inv_Entry_M(m)); + //@ assert ((V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); true && true)) && inv_Entry_M(m)); ^ \ No newline at end of file From 1ae253c504ba2274635403a152229cf0ac99cd63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 13:52:35 +0200 Subject: [PATCH 181/706] Check compatibility of map type related utility methods --- .../overture/vdm2jml/tests/V2JCallTests.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java index 8744edf1b3..32508564bb 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java @@ -7,12 +7,31 @@ import org.junit.Test; import org.overture.codegen.runtime.V2J; import org.overture.codegen.vdm2jml.predgen.info.AbstractSetSeqInfo; +import org.overture.codegen.vdm2jml.predgen.info.MapInfo; import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; import org.overture.codegen.vdm2jml.predgen.info.SetInfo; import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; public class V2JCallTests { + @Test + public void checkIsMap() + { + assertMethod(MapInfo.IS_MAP_METHOD, Object.class); + } + + @Test + public void checkGetDom() + { + assertMethod(MapInfo.GET_DOM_METHOD, Object.class, int.class); + } + + @Test + public void checkGetRng() + { + assertMethod(MapInfo.GET_RNG_METHOD, Object.class, int.class); + } + @Test public void checkIsSet() { From 60275251acf98455da1746246faaaa9103580355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 13:57:36 +0200 Subject: [PATCH 182/706] Group all seq type tests --- .../tests/exec/JmlSeq1TypeExecTests.java | 34 ------------------- .../Seq1AssignEmptySet/Entry.java | 0 .../Seq1AssignEmptySet.vdmsl | 0 .../Seq1AssignEmptySet.vdmsl.result | 0 .../Entry.java | 0 .../Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl | 0 ...1EvenNatsMaskedAsNamedTypeInv.vdmsl.result | 0 7 files changed, 34 deletions(-) delete mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeq1TypeExecTests.java rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{seq1type => seqtype}/Seq1AssignEmptySet/Entry.java (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{seq1type => seqtype}/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{seq1type => seqtype}/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{seq1type => seqtype}/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{seq1type => seqtype}/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{seq1type => seqtype}/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result (100%) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeq1TypeExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeq1TypeExecTests.java deleted file mode 100644 index 77b48b13a5..0000000000 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSeq1TypeExecTests.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.overture.vdm2jml.tests.exec; - -import java.io.File; -import java.util.Collection; - -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; -import org.overture.codegen.utils.GeneralUtils; -import org.overture.vdm2jml.tests.util.TestUtil; - -@RunWith(Parameterized.class) -public class JmlSeq1TypeExecTests extends JmlExecTestBase -{ - public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "seq1type"; - - public static final String PROPERTY_ID = "seq1type"; - - public JmlSeq1TypeExecTests(File inputFile) - { - super(inputFile); - } - - @Parameters(name = "{index}: {0}") - public static Collection data() - { - return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); - } - - protected String getPropertyId() - { - return PROPERTY_ID; - } -} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Entry.java similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Entry.java rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seq1type/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result From e3268fbe1378d87590f09e62ac408fd04f3aa579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 14:02:50 +0200 Subject: [PATCH 183/706] Add more tests to exercise checking of map types --- .../maptype/MapBoolToNatAssignNil/Entry.java | 54 +++++++++++++++++++ .../MapBoolToNatAssignNil.vdmsl | 26 +++++++++ .../MapBoolToNatAssignNil.vdmsl.result | 7 +++ 3 files changed, 87 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java new file mode 100644 index 0000000000..1c7f6c0bfe --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java @@ -0,0 +1,54 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMMap ignorePattern_1 = MapUtil.map(new Maplet(false, 0L), + new Maplet(true, 1L)); + + //@ assert (V2J.isMap(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_bool(V2J.getDom(ignorePattern_1,i)) && Utils.is_nat(V2J.getRng(ignorePattern_1,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMMap ignorePattern_2 = mapNil(); + + //@ assert (V2J.isMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_bool(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static VDMMap mapNil() { + VDMMap ret_1 = null; + + //@ assert ((ret_1 == null) || (V2J.isMap(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_bool(V2J.getDom(ret_1,i)) && Utils.is_nat(V2J.getRng(ret_1,i))))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl new file mode 100644 index 0000000000..de20aa48ce --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl @@ -0,0 +1,26 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : map bool to nat = {false |-> 0, true |-> 1} in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : map bool to nat = mapNil() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +mapNil : () -> [map bool to nat] +mapNil () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl.result new file mode 100644 index 0000000000..30abf72aa8 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:33: JML assertion is false + //@ assert (V2J.isMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_bool(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); + ^ +"After illegal use" \ No newline at end of file From 35b42228f00133190eeff4cd4306966f19cd16c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 16:22:01 +0200 Subject: [PATCH 184/706] Update IR to support injective maps --- core/codegen/ir/src/main/resources/cg.astv2 | 1 + .../codegen/assistant/ExpAssistantCG.java | 20 +++++++++++++++++ .../codegen/visitor/TypeVisitorCG.java | 22 +++++++------------ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/core/codegen/ir/src/main/resources/cg.astv2 b/core/codegen/ir/src/main/resources/cg.astv2 index 8e4784cec0..8438911c42 100644 --- a/core/codegen/ir/src/main/resources/cg.astv2 +++ b/core/codegen/ir/src/main/resources/cg.astv2 @@ -588,6 +588,7 @@ externalType {-> package='org.overture.codegen.cgast.utils'} #map {-> package='org.overture.codegen.cgast.types' | [empty]:java_Boolean + | [injective]:java_Boolean | [from]:CG.#type | [to]:CG.#type } = {map} diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/ExpAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/ExpAssistantCG.java index 3067dce657..bd192dbe99 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/ExpAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/ExpAssistantCG.java @@ -49,6 +49,7 @@ import org.overture.ast.types.ANatOneNumericBasicType; import org.overture.ast.types.AUnionType; import org.overture.ast.types.PType; +import org.overture.ast.types.SMapTypeBase; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.SMultipleBindCG; @@ -676,4 +677,23 @@ public ANullExpCG consNullExp() return nullExp; } + + public STypeCG handleMapType(SMapTypeBase node, IRInfo question, boolean isInjective) throws AnalysisException + { + PType from = node.getFrom(); + PType to = node.getTo(); + boolean empty = node.getEmpty(); + + STypeCG fromCg = from.apply(question.getTypeVisitor(), question); + STypeCG toCg = to.apply(question.getTypeVisitor(), question); + + AMapMapTypeCG mapType = new AMapMapTypeCG(); + mapType.setFrom(fromCg); + mapType.setTo(toCg); + mapType.setEmpty(empty); + + mapType.setInjective(isInjective); + + return mapType; + } } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/TypeVisitorCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/TypeVisitorCG.java index cfadd43719..03d744d7a7 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/TypeVisitorCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/TypeVisitorCG.java @@ -31,6 +31,7 @@ import org.overture.ast.types.ACharBasicType; import org.overture.ast.types.AClassType; import org.overture.ast.types.AFunctionType; +import org.overture.ast.types.AInMapMapType; import org.overture.ast.types.AIntNumericBasicType; import org.overture.ast.types.AMapMapType; import org.overture.ast.types.ANamedInvariantType; @@ -62,7 +63,6 @@ import org.overture.codegen.cgast.types.ACharBasicTypeCG; import org.overture.codegen.cgast.types.AClassTypeCG; import org.overture.codegen.cgast.types.AIntNumericBasicTypeCG; -import org.overture.codegen.cgast.types.AMapMapTypeCG; import org.overture.codegen.cgast.types.ANat1NumericBasicTypeCG; import org.overture.codegen.cgast.types.ANatNumericBasicTypeCG; import org.overture.codegen.cgast.types.AQuoteTypeCG; @@ -193,21 +193,15 @@ public STypeCG caseASetType(ASetType node, IRInfo question) public STypeCG caseAMapMapType(AMapMapType node, IRInfo question) throws AnalysisException { - PType from = node.getFrom(); - PType to = node.getTo(); - boolean empty = node.getEmpty(); - - STypeCG fromCg = from.apply(question.getTypeVisitor(), question); - STypeCG toCg = to.apply(question.getTypeVisitor(), question); - - AMapMapTypeCG mapType = new AMapMapTypeCG(); - mapType.setFrom(fromCg); - mapType.setTo(toCg); - mapType.setEmpty(empty); - - return mapType; + return question.getExpAssistant().handleMapType(node, question, false); } + @Override + public STypeCG caseAInMapMapType(AInMapMapType node, IRInfo question) throws AnalysisException + { + return question.getExpAssistant().handleMapType(node, question, true); + } + @Override public STypeCG caseAProductType(AProductType node, IRInfo question) throws AnalysisException From 499b06eac105bfd3858b6f82424a3f694a7ed359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 16:22:40 +0200 Subject: [PATCH 185/706] Check compatibility of 'isInjMap' runtime method --- .../test/java/org/overture/vdm2jml/tests/V2JCallTests.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java index 32508564bb..1850afc3de 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java @@ -14,6 +14,12 @@ public class V2JCallTests { + @Test + public void checkIsInjMap() + { + assertMethod(MapInfo.IS_INJECTIVE_MAP_METHOD, Object.class); + } + @Test public void checkIsMap() { From b008566e05d65da3c27fa0b4ca7eded579090386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 16:25:07 +0200 Subject: [PATCH 186/706] Add support for JML generation of injective map types --- .../org/overture/codegen/vdm2jml/predgen/TypePredUtil.java | 4 +++- .../org/overture/codegen/vdm2jml/predgen/info/MapInfo.java | 7 +++++-- .../vdm2jml/predgen/info/NamedTypeInvDepCalculator.java | 7 +++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index 86b698f66e..f9be56e13f 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -280,7 +280,9 @@ else if(type instanceof AMapMapTypeCG) AbstractTypeInfo domInfo = findTypeInfo(mapType.getFrom()); AbstractTypeInfo rngInfo = findTypeInfo(mapType.getTo()); - return new MapInfo(assist.allowsNull(mapType), domInfo, rngInfo); + boolean injective = BooleanUtils.isTrue(mapType.getInjective()); + + return new MapInfo(assist.allowsNull(mapType), domInfo, rngInfo, injective); } else if(type instanceof AUnknownTypeCG) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java index a9a5d43b89..c8b5c95272 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java @@ -7,17 +7,20 @@ public class MapInfo extends AbstractCollectionInfo { public static final String IS_MAP_METHOD = "isMap"; + public static final String IS_INJECTIVE_MAP_METHOD = "isInjMap"; public static final String GET_DOM_METHOD = "getDom"; public static final String GET_RNG_METHOD = "getRng"; private AbstractTypeInfo domType; private AbstractTypeInfo rngType; + private boolean injective; - public MapInfo(boolean optional, AbstractTypeInfo domType, AbstractTypeInfo rngType) + public MapInfo(boolean optional, AbstractTypeInfo domType, AbstractTypeInfo rngType, boolean injective) { super(optional); this.domType = domType; this.rngType = rngType; + this.injective = injective; } @Override @@ -42,6 +45,6 @@ public String consElementCheck(String enclosingClass, String javaRootPackage, St public String consCollectionCheck(String arg) { //e.g. (V2J.isMap(m) && (\forall int i; 0 <= i && i < VDM2JML.size(m); Utils.is_nat(VDM2JML.getDom(i,m)) && Utils.is_nat(VDM2JML.getRng(i,m)))); - return consSubjectCheck(V2J.class.getSimpleName(), IS_MAP_METHOD, arg); + return consSubjectCheck(V2J.class.getSimpleName(), injective ? IS_INJECTIVE_MAP_METHOD :IS_MAP_METHOD, arg); } } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java index 5e34b8deb8..5ec66b9238 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInvDepCalculator.java @@ -7,7 +7,8 @@ import org.overture.ast.analysis.AnalysisException; import org.overture.ast.analysis.DepthFirstAnalysisAdaptor; -import org.overture.ast.types.ABracketType; +import org.overture.ast.types.ABracketType; +import org.overture.ast.types.AInMapMapType; import org.overture.ast.types.ANamedInvariantType; import org.overture.ast.types.AOptionalType; import org.overture.ast.types.AProductType; @@ -177,7 +178,9 @@ else if(type instanceof SMapTypeBase) AbstractTypeInfo fromInfo = create(info, mapType.getFrom(), visited); AbstractTypeInfo toInfo = create(info, mapType.getTo(), visited); - return new MapInfo(optional, fromInfo, toInfo); + boolean injective = type instanceof AInMapMapType; + + return new MapInfo(optional, fromInfo, toInfo, injective); } else if(type instanceof AUnknownType) { From a3e6b56f586d5633bdf6d1881fd9aa52ce617b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 16:28:08 +0200 Subject: [PATCH 187/706] Add tests to exercise checking of injective maps --- .../AssignNonInjMapToInjMap.vdmsl | 21 +++++ .../AssignNonInjMapToInjMap.vdmsl.result | 7 ++ .../AssignNonInjMapToInjMap/Entry.java | 47 ++++++++++ .../Entry.java | 66 ++++++++++++++ .../ReturnNonInjMapWhereInjMapRequired.vdmsl | 37 ++++++++ ...nNonInjMapWhereInjMapRequired.vdmsl.result | 10 +++ .../V2.java | 85 +++++++++++++++++++ 7 files changed, 273 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/V2.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl new file mode 100644 index 0000000000..37d97c49a2 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl @@ -0,0 +1,21 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : map nat to nat = {1 |-> 2, 3 |-> 4} in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : inmap nat to nat = {1 |-> 2, 3 |-> 2} in skip; + IO`println("After illegal use"); + return 0; +); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl.result new file mode 100644 index 0000000000..de4f907fac --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl.result @@ -0,0 +1,7 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:34: JML assertion is false + //@ assert (V2J.isInjMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); + ^ +"After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java new file mode 100644 index 0000000000..20d7f246d4 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java @@ -0,0 +1,47 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMMap ignorePattern_1 = MapUtil.map(new Maplet(1L, 2L), + new Maplet(3L, 4L)); + + //@ assert (V2J.isMap(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat(V2J.getDom(ignorePattern_1,i)) && Utils.is_nat(V2J.getRng(ignorePattern_1,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMMap ignorePattern_2 = MapUtil.map(new Maplet(1L, 2L), + new Maplet(3L, 2L)); + + //@ assert (V2J.isInjMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java new file mode 100644 index 0000000000..f69f0a3e1d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java @@ -0,0 +1,66 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + { + VDMMap ignorePattern_1 = consInjMap(); + + //@ assert (V2J.isInjMap(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat(V2J.getDom(ignorePattern_1,i)) && Utils.is_(V2J.getRng(ignorePattern_1,i),project.Entrytypes.V2.class))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before illegal use"); + + { + VDMMap ignorePattern_2 = consInjMapErr(); + + //@ assert (V2J.isInjMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.getDom(ignorePattern_2,i)) && Utils.is_(V2J.getRng(ignorePattern_2,i),project.Entrytypes.V2.class))); + + /* skip */ + } + + IO.println("After illegal use"); + + return 0L; + } + + /*@ pure @*/ + public static VDMMap consInjMap() { + VDMMap ret_1 = MapUtil.map(new Maplet(1L, + new project.Entrytypes.V2(1L, 2L)), + new Maplet(2L, new project.Entrytypes.V2(2L, 1L))); + + //@ assert (V2J.isInjMap(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.getDom(ret_1,i)) && Utils.is_(V2J.getRng(ret_1,i),project.Entrytypes.V2.class))); + return Utils.copy(ret_1); + } + + /*@ pure @*/ + public static VDMMap consInjMapErr() { + VDMMap ret_2 = MapUtil.map(new Maplet(1L, + new project.Entrytypes.V2(1L, 2L)), + new Maplet(2L, new project.Entrytypes.V2(2L, 1L)), + new Maplet(3L, new project.Entrytypes.V2(1L, 2L))); + + //@ assert (V2J.isInjMap(ret_2) && (\forall int i; 0 <= i && i < V2J.size(ret_2); Utils.is_nat(V2J.getDom(ret_2,i)) && Utils.is_(V2J.getRng(ret_2,i),project.Entrytypes.V2.class))); + return Utils.copy(ret_2); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl new file mode 100644 index 0000000000..68f2d14c4b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl @@ -0,0 +1,37 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +V2 :: + x : int + y : int; + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : inmap nat to V2 = consInjMap() in skip; + IO`println("After legal use"); + IO`println("Before illegal use"); + let - : inmap nat to V2 = consInjMapErr() in skip; + IO`println("After illegal use"); + return 0; +); + +functions + +consInjMap : () -> inmap nat to V2 +consInjMap () == + {1 |-> mk_V2(1,2), 2 |-> mk_V2(2,1)}; + +consInjMapErr : () -> inmap nat to V2 +consInjMapErr () == + {1 |-> mk_V2(1,2), 2 |-> mk_V2(2,1), 3 |-> mk_V2(1,2)}; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl.result new file mode 100644 index 0000000000..7587edd80d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl.result @@ -0,0 +1,10 @@ +"Before legal use" +"After legal use" +"Before illegal use" +Entry.java:59: JML assertion is false + //@ assert (V2J.isInjMap(ret_2) && (\forall int i; 0 <= i && i < V2J.size(ret_2); Utils.is_nat(V2J.getDom(ret_2,i)) && Utils.is_(V2J.getRng(ret_2,i),project.Entrytypes.V2.class))); + ^ +Entry.java:32: JML assertion is false + //@ assert (V2J.isInjMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.getDom(ignorePattern_2,i)) && Utils.is_(V2J.getRng(ignorePattern_2,i),project.Entrytypes.V2.class))); + ^ +"After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/V2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/V2.java new file mode 100644 index 0000000000..50930851e4 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/V2.java @@ -0,0 +1,85 @@ +package project.Entrytypes; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class V2 implements Record { + public Number x; + public Number y; + + public V2(final Number _x, final Number _y) { + //@ assert Utils.is_int(_x); + + //@ assert Utils.is_int(_y); + x = _x; + //@ assert Utils.is_int(x); + y = _y; + + //@ assert Utils.is_int(y); + } + + /*@ pure @*/ + public boolean equals(final Object obj) { + if (!(obj instanceof project.Entrytypes.V2)) { + return false; + } + + project.Entrytypes.V2 other = ((project.Entrytypes.V2) obj); + + return (Utils.equals(x, other.x)) && (Utils.equals(y, other.y)); + } + + /*@ pure @*/ + public int hashCode() { + return Utils.hashCode(x, y); + } + + /*@ pure @*/ + public project.Entrytypes.V2 copy() { + return new project.Entrytypes.V2(x, y); + } + + /*@ pure @*/ + public String toString() { + return "mk_Entry`V2" + Utils.formatFields(x, y); + } + + /*@ pure @*/ + public Number get_x() { + Number ret_3 = x; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_3)); + return ret_3; + } + + public void set_x(final Number _x) { + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); + x = _x; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); + } + + /*@ pure @*/ + public Number get_y() { + Number ret_4 = y; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_4)); + return ret_4; + } + + public void set_y(final Number _y) { + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_y)); + y = _y; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(y)); + } + + /*@ pure @*/ + public Boolean valid() { + return true; + } +} From 5504d8ffd1e9a27e16f05ca8596ce6b68c82bf3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 18:01:56 +0200 Subject: [PATCH 188/706] Prepare testing of handling of quantified expressions --- .../tests/exec/JmlQuantifiersExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifiersExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifiersExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifiersExecTests.java new file mode 100644 index 0000000000..2f5383d610 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifiersExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlQuantifiersExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "quantifiers"; + + public static final String PROPERTY_ID = "quantifiers"; + + public JmlQuantifiersExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From 59366d2ed9b72a627eb1f86ad54880249a2956e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 18:02:28 +0200 Subject: [PATCH 189/706] Add tests to exercise handling of quantified expressions --- .../quantifiers/Exists/Entry.java | 51 +++++++++++++++++++ .../quantifiers/Exists/Exists.vdmsl | 24 +++++++++ .../quantifiers/Exists/Exists.vdmsl.result | 1 + .../quantifiers/Exists1/Entry.java | 51 +++++++++++++++++++ .../quantifiers/Exists1/Exists1.vdmsl | 24 +++++++++ .../quantifiers/ForAll/Entry.java | 51 +++++++++++++++++++ .../quantifiers/ForAll/ForAll.vdmsl | 24 +++++++++ .../quantifiers/ForAll/ForAll.vdmsl.result | 1 + 8 files changed, 227 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Exists1.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Entry.java new file mode 100644 index 0000000000..0fbcdf329e --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Entry.java @@ -0,0 +1,51 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Boolean ignorePattern_1 = f(); + //@ assert Utils.is_bool(ignorePattern_1); + { + IO.println("Done! Expected no errors"); + + return 0L; + } + } + + /*@ pure @*/ + public static Boolean f() { + Boolean existsExpResult_1 = false; + + //@ assert Utils.is_bool(existsExpResult_1); + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_nat1(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && !(existsExpResult_1);) { + Number x = ((Number) iterator_1.next()); + //@ assert Utils.is_nat1(x); + existsExpResult_1 = x.longValue() > 0L; + + //@ assert Utils.is_bool(existsExpResult_1); + } + + Boolean ret_1 = existsExpResult_1; + + //@ assert Utils.is_bool(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl new file mode 100644 index 0000000000..b202563cee --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl @@ -0,0 +1,24 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +let - = f() +in +( + IO`println("Done! Expected no errors"); + return 0; +); + +functions + +f : () -> bool +f () == + exists x in set {1,2,3} & x > 0; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl.result new file mode 100644 index 0000000000..19b51e8cc9 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no errors" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Entry.java new file mode 100644 index 0000000000..cd1a237fdd --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Entry.java @@ -0,0 +1,51 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Boolean ignorePattern_1 = f(); + //@ assert Utils.is_bool(ignorePattern_1); + { + IO.println("Done! Expected no errors"); + + return 0L; + } + } + + /*@ pure @*/ + public static Boolean f() { + Long exists1Counter_1 = 0L; + + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_nat1(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && (exists1Counter_1.longValue() < 2L);) { + Number x = ((Number) iterator_1.next()); + + //@ assert Utils.is_nat1(x); + if (x.longValue() > 0L) { + exists1Counter_1++; + } + } + + Boolean ret_1 = Utils.equals(exists1Counter_1, 1L); + + //@ assert Utils.is_bool(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Exists1.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Exists1.vdmsl new file mode 100644 index 0000000000..de6d152302 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Exists1.vdmsl @@ -0,0 +1,24 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +let - = f() +in +( + IO`println("Done! Expected no errors"); + return 0; +); + +functions + +f : () -> bool +f () == + exists1 x in set {1,2,3} & x > 0; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/Entry.java new file mode 100644 index 0000000000..39472e84b0 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/Entry.java @@ -0,0 +1,51 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + Boolean ignorePattern_1 = f(); + //@ assert Utils.is_bool(ignorePattern_1); + { + IO.println("Done! Expected no errors"); + + return 0L; + } + } + + /*@ pure @*/ + public static Boolean f() { + Boolean forAllExpResult_1 = true; + + //@ assert Utils.is_bool(forAllExpResult_1); + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_nat1(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && forAllExpResult_1;) { + Number x = ((Number) iterator_1.next()); + //@ assert Utils.is_nat1(x); + forAllExpResult_1 = x.longValue() > 0L; + + //@ assert Utils.is_bool(forAllExpResult_1); + } + + Boolean ret_1 = forAllExpResult_1; + + //@ assert Utils.is_bool(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl new file mode 100644 index 0000000000..00c12d0dca --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl @@ -0,0 +1,24 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +let - = f() +in +( + IO`println("Done! Expected no errors"); + return 0; +); + +functions + +f : () -> bool +f () == + forall x in set {1,2,3} & x > 0; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl.result new file mode 100644 index 0000000000..19b51e8cc9 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no errors" \ No newline at end of file From e06ccfe9df9c4d95168d4257821419a1fe4e4083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 18:19:49 +0200 Subject: [PATCH 190/706] Skip one of the quantifier tests --- .../org/overture/vdm2jml/tests/exec/JmlExecTestBase.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java index 95b66517d2..a7c7583e8c 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java @@ -57,6 +57,7 @@ public void assumeTools() @Test public void execJml() { + checkIfSkipped(); try { configureResultGeneration(); @@ -86,6 +87,11 @@ public void execJml() } } + private void checkIfSkipped() + { + Assume.assumeFalse("OpenJML cannot compile this test - there is a bug", inputFile.getName().equals("Exists1.vdmsl")); + } + protected void checkOpenJmlOutput(String actualRes) throws IOException { String expectedRes = GeneralUtils.readFromFile(getResultFile()).trim(); From bfcc089f31793968dd65f163a483d2efd348c6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 18:21:50 +0200 Subject: [PATCH 191/706] Catch more types that do not need handling --- .../org/overture/codegen/vdm2jml/predgen/TypePredUtil.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index f9be56e13f..c733873775 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -11,6 +11,8 @@ import org.overture.codegen.cgast.declarations.ANamedTypeDeclCG; import org.overture.codegen.cgast.expressions.SVarExpCG; import org.overture.codegen.cgast.statements.AMetaStmCG; +import org.overture.codegen.cgast.types.AClassTypeCG; +import org.overture.codegen.cgast.types.AExternalTypeCG; import org.overture.codegen.cgast.types.AMapMapTypeCG; import org.overture.codegen.cgast.types.ARecordTypeCG; import org.overture.codegen.cgast.types.ASeqSeqTypeCG; @@ -285,8 +287,9 @@ else if(type instanceof AMapMapTypeCG) return new MapInfo(assist.allowsNull(mapType), domInfo, rngInfo, injective); } - else if(type instanceof AUnknownTypeCG) + else if(type instanceof AUnknownTypeCG || type instanceof AClassTypeCG || type instanceof AExternalTypeCG) { + // Iterators are class types for instance return new UnknownLeaf(); } else From f0f5e87d0c834b7db33351bde230e71cfc5080c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 17 Oct 2015 18:23:05 +0200 Subject: [PATCH 192/706] Fix: The JML generator did not take loop variable declarations into account --- .../codegen/vdm2jml/predgen/TypePredHandler.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java index 4c5aea7bba..bd6ceb1c66 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java @@ -19,6 +19,7 @@ import org.overture.codegen.cgast.statements.AAssignToExpStmCG; import org.overture.codegen.cgast.statements.ABlockStmCG; import org.overture.codegen.cgast.statements.ACallObjectExpStmCG; +import org.overture.codegen.cgast.statements.AForLoopStmCG; import org.overture.codegen.cgast.statements.AMapSeqUpdateStmCG; import org.overture.codegen.cgast.statements.AMetaStmCG; import org.overture.codegen.cgast.statements.AReturnStmCG; @@ -257,6 +258,7 @@ public List handleMapSeq(AMapSeqUpdateStmCG node) Logger.getLog().printErrorln("Expected collection to be a variable expression at this point. Got: " + col + " in '" + this.getClass().getSimpleName() + "'"); + return null; } SVarExpCG var = ((SVarExpCG) col); @@ -438,7 +440,9 @@ public void handleAssign(AAssignToExpStmCG node) public ABlockStmCG getEncBlockStm(AVarDeclCG varDecl) { - if (varDecl.parent() instanceof ABlockStmCG) + INode parent = varDecl.parent(); + + if (parent instanceof ABlockStmCG) { ABlockStmCG parentBlock = (ABlockStmCG) varDecl.parent(); @@ -462,6 +466,11 @@ public ABlockStmCG getEncBlockStm(AVarDeclCG varDecl) return parentBlock; } + else if(parent instanceof AForLoopStmCG) + { + // Do nothing + return null; + } else { Logger.getLog().printErrorln("Expected parent of local variable " From c971346c03cad6fb3bc0547fbf36751062b531c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 10:28:39 +0200 Subject: [PATCH 193/706] Moving files related to JML generation of quantifiers --- ...ntifiersExecTests.java => JmlQuantifierExecTests.java} | 8 ++++---- .../{quantifiers => quantifier}/Exists/Entry.java | 0 .../{quantifiers => quantifier}/Exists/Exists.vdmsl | 0 .../Exists/Exists.vdmsl.result | 0 .../{quantifiers => quantifier}/Exists1/Entry.java | 0 .../{quantifiers => quantifier}/Exists1/Exists1.vdmsl | 0 .../{quantifiers => quantifier}/ForAll/Entry.java | 0 .../{quantifiers => quantifier}/ForAll/ForAll.vdmsl | 0 .../ForAll/ForAll.vdmsl.result | 0 9 files changed, 4 insertions(+), 4 deletions(-) rename core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/{JmlQuantifiersExecTests.java => JmlQuantifierExecTests.java} (76%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{quantifiers => quantifier}/Exists/Entry.java (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{quantifiers => quantifier}/Exists/Exists.vdmsl (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{quantifiers => quantifier}/Exists/Exists.vdmsl.result (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{quantifiers => quantifier}/Exists1/Entry.java (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{quantifiers => quantifier}/Exists1/Exists1.vdmsl (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{quantifiers => quantifier}/ForAll/Entry.java (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{quantifiers => quantifier}/ForAll/ForAll.vdmsl (100%) rename core/codegen/vdm2jml/src/test/resources/dynamic_analysis/{quantifiers => quantifier}/ForAll/ForAll.vdmsl.result (100%) diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifiersExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifierExecTests.java similarity index 76% rename from core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifiersExecTests.java rename to core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifierExecTests.java index 2f5383d610..d024fe9d59 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifiersExecTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlQuantifierExecTests.java @@ -10,13 +10,13 @@ import org.overture.vdm2jml.tests.util.TestUtil; @RunWith(Parameterized.class) -public class JmlQuantifiersExecTests extends JmlExecTestBase +public class JmlQuantifierExecTests extends JmlExecTestBase { - public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "quantifiers"; + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "quantifier"; - public static final String PROPERTY_ID = "quantifiers"; + public static final String PROPERTY_ID = "quantifier"; - public JmlQuantifiersExecTests(File inputFile) + public JmlQuantifierExecTests(File inputFile) { super(inputFile); } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Entry.java similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Entry.java rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Exists.vdmsl similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Exists.vdmsl diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Exists.vdmsl.result similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists/Exists.vdmsl.result rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Exists.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists1/Entry.java similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Entry.java rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists1/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Exists1.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists1/Exists1.vdmsl similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/Exists1/Exists1.vdmsl rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists1/Exists1.vdmsl diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/Entry.java similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/Entry.java rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/Entry.java diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/ForAll.vdmsl similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/ForAll.vdmsl diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/ForAll.vdmsl.result similarity index 100% rename from core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifiers/ForAll/ForAll.vdmsl.result rename to core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/ForAll.vdmsl.result From 0ee3aaaf6a809bda8591de50a97c385f422e3293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 10:42:44 +0200 Subject: [PATCH 194/706] Prepare testing of JML generation of comprehensions --- .../tests/exec/JmlComprehensionExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComprehensionExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComprehensionExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComprehensionExecTests.java new file mode 100644 index 0000000000..d96ca8f4f1 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComprehensionExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlComprehensionExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "comprehension"; + + public static final String PROPERTY_ID = "comprehension"; + + public JmlComprehensionExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From 6a365c90a2ea5543cad1f92293b8e17c87a88b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 10:44:05 +0200 Subject: [PATCH 195/706] Add tests to exercise JML generation of comprehensions --- .../comprehension/Map/Entry.java | 135 ++++++++++++++++++ .../comprehension/Map/Map.vdmsl | 28 ++++ .../comprehension/Map/Map.vdmsl.result | 10 ++ .../comprehension/Seq/Entry.java | 135 ++++++++++++++++++ .../comprehension/Seq/Seq.vdmsl | 28 ++++ .../comprehension/Seq/Seq.vdmsl.result | 10 ++ .../comprehension/Set/Entry.java | 135 ++++++++++++++++++ .../comprehension/Set/Set.vdmsl | 28 ++++ .../comprehension/Set/Set.vdmsl.result | 10 ++ 9 files changed, 519 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java new file mode 100644 index 0000000000..7e75a24cad --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java @@ -0,0 +1,135 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + VDMMap mapCompResult_1 = MapUtil.map(); + + //@ assert (V2J.isMap(mapCompResult_1) && (\forall int i; 0 <= i && i < V2J.size(mapCompResult_1); Utils.is_nat1(V2J.getDom(mapCompResult_1,i)) && Utils.is_nat1(V2J.getRng(mapCompResult_1,i)))); + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_nat1(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { + Number x = ((Number) iterator_1.next()); + + //@ assert Utils.is_nat1(x); + if (x.longValue() > 0L) { + mapCompResult_1 = MapUtil.munion(Utils.copy(mapCompResult_1), + MapUtil.map(new Maplet(x, x))); + + //@ assert (V2J.isMap(mapCompResult_1) && (\forall int i; 0 <= i && i < V2J.size(mapCompResult_1); Utils.is_nat1(V2J.getDom(mapCompResult_1,i)) && Utils.is_nat1(V2J.getRng(mapCompResult_1,i)))); + } + } + + { + VDMMap ignorePattern_1 = Utils.copy(mapCompResult_1); + + //@ assert (V2J.isInjMap(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat(V2J.getDom(ignorePattern_1,i)) && Utils.is_nat(V2J.getRng(ignorePattern_1,i)))); + + /* skip */ + } + + VDMMap mapCompResult_2 = MapUtil.map(); + + //@ assert (V2J.isMap(mapCompResult_2) && (\forall int i; 0 <= i && i < V2J.size(mapCompResult_2); Utils.is_nat1(V2J.getDom(mapCompResult_2,i)) && Utils.is_nat1(V2J.getRng(mapCompResult_2,i)))); + VDMSet set_2 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_2) && (\forall int i; 0 <= i && i < V2J.size(set_2); Utils.is_nat1(V2J.get(set_2,i)))); + for (Iterator iterator_2 = set_2.iterator(); iterator_2.hasNext();) { + Number x = ((Number) iterator_2.next()); + //@ assert Utils.is_nat1(x); + mapCompResult_2 = MapUtil.munion(Utils.copy(mapCompResult_2), + MapUtil.map(new Maplet(x, x))); + + //@ assert (V2J.isMap(mapCompResult_2) && (\forall int i; 0 <= i && i < V2J.size(mapCompResult_2); Utils.is_nat1(V2J.getDom(mapCompResult_2,i)) && Utils.is_nat1(V2J.getRng(mapCompResult_2,i)))); + } + + { + VDMMap ignorePattern_2 = Utils.copy(mapCompResult_2); + + //@ assert (V2J.isInjMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before violations"); + + VDMMap mapCompResult_3 = MapUtil.map(); + + //@ assert (V2J.isMap(mapCompResult_3) && (\forall int i; 0 <= i && i < V2J.size(mapCompResult_3); Utils.is_nat1(V2J.getDom(mapCompResult_3,i)) && Utils.is_nat1(V2J.getRng(mapCompResult_3,i)))); + VDMSet set_3 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_3) && (\forall int i; 0 <= i && i < V2J.size(set_3); Utils.is_nat1(V2J.get(set_3,i)))); + for (Iterator iterator_3 = set_3.iterator(); iterator_3.hasNext();) { + Number x = ((Number) iterator_3.next()); + + //@ assert Utils.is_nat1(x); + if (x.longValue() > 1L) { + mapCompResult_3 = MapUtil.munion(Utils.copy(mapCompResult_3), + MapUtil.map(new Maplet(x, 2L))); + + //@ assert (V2J.isMap(mapCompResult_3) && (\forall int i; 0 <= i && i < V2J.size(mapCompResult_3); Utils.is_nat1(V2J.getDom(mapCompResult_3,i)) && Utils.is_nat1(V2J.getRng(mapCompResult_3,i)))); + } + } + + { + VDMMap ignorePattern_3 = Utils.copy(mapCompResult_3); + + //@ assert (V2J.isInjMap(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.getDom(ignorePattern_3,i)) && Utils.is_nat(V2J.getRng(ignorePattern_3,i)))); + + /* skip */ + } + + VDMMap mapCompResult_4 = MapUtil.map(); + + //@ assert (V2J.isMap(mapCompResult_4) && (\forall int i; 0 <= i && i < V2J.size(mapCompResult_4); Utils.is_nat1(V2J.getDom(mapCompResult_4,i)) && Utils.is_nat1(V2J.getRng(mapCompResult_4,i)))); + VDMSet set_4 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_4) && (\forall int i; 0 <= i && i < V2J.size(set_4); Utils.is_nat1(V2J.get(set_4,i)))); + for (Iterator iterator_4 = set_4.iterator(); iterator_4.hasNext();) { + Number x = ((Number) iterator_4.next()); + //@ assert Utils.is_nat1(x); + mapCompResult_4 = MapUtil.munion(Utils.copy(mapCompResult_4), + MapUtil.map(new Maplet(x, 2L))); + + //@ assert (V2J.isMap(mapCompResult_4) && (\forall int i; 0 <= i && i < V2J.size(mapCompResult_4); Utils.is_nat1(V2J.getDom(mapCompResult_4,i)) && Utils.is_nat1(V2J.getRng(mapCompResult_4,i)))); + } + + { + VDMMap ignorePattern_4 = Utils.copy(mapCompResult_4); + + //@ assert (V2J.isInjMap(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat(V2J.getDom(ignorePattern_4,i)) && Utils.is_nat(V2J.getRng(ignorePattern_4,i)))); + + /* skip */ + } + + IO.println("After violations"); + + return 0L; + } + + /*@ pure @*/ + public static VDMSet xs() { + VDMSet ret_1 = SetUtil.set(); + + //@ assert (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.get(ret_1,i)))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl new file mode 100644 index 0000000000..51316448b9 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl @@ -0,0 +1,28 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : inmap nat to nat = {x |-> x | x in set {1,2,3} & x > 0} in skip; + let - : inmap nat to nat = {x |-> x | x in set {1,2,3}} in skip; + IO`println("After legal use"); + IO`println("Before violations"); + let - : inmap nat to nat = {x |-> 2 | x in set {1,2,3} & x > 1} in skip; + let - : inmap nat to nat = {x |-> 2 | x in set {1,2,3}} in skip; + IO`println("After violations"); + return 0; +); + +functions + +xs : () -> set of nat +xs () == {}; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl.result new file mode 100644 index 0000000000..2fc97a15b1 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl.result @@ -0,0 +1,10 @@ +"Before legal use" +"After legal use" +"Before violations" +Entry.java:91: JML assertion is false + //@ assert (V2J.isInjMap(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.getDom(ignorePattern_3,i)) && Utils.is_nat(V2J.getRng(ignorePattern_3,i)))); + ^ +Entry.java:114: JML assertion is false + //@ assert (V2J.isInjMap(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat(V2J.getDom(ignorePattern_4,i)) && Utils.is_nat(V2J.getRng(ignorePattern_4,i)))); + ^ +"After violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Entry.java new file mode 100644 index 0000000000..ca108cc341 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Entry.java @@ -0,0 +1,135 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + VDMSeq seqCompResult_1 = SeqUtil.seq(); + + //@ assert (V2J.isSeq(seqCompResult_1) && (\forall int i; 0 <= i && i < V2J.size(seqCompResult_1); Utils.is_nat1(V2J.get(seqCompResult_1,i)))); + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_nat1(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { + Number x = ((Number) iterator_1.next()); + + //@ assert Utils.is_nat1(x); + if (x.longValue() > 0L) { + seqCompResult_1 = SeqUtil.conc(Utils.copy(seqCompResult_1), + SeqUtil.seq(x)); + + //@ assert (V2J.isSeq(seqCompResult_1) && (\forall int i; 0 <= i && i < V2J.size(seqCompResult_1); Utils.is_nat1(V2J.get(seqCompResult_1,i)))); + } + } + + { + VDMSeq ignorePattern_1 = Utils.copy(seqCompResult_1); + + //@ assert (V2J.isSeq1(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat(V2J.get(ignorePattern_1,i)))); + + /* skip */ + } + + VDMSeq seqCompResult_2 = SeqUtil.seq(); + + //@ assert (V2J.isSeq(seqCompResult_2) && (\forall int i; 0 <= i && i < V2J.size(seqCompResult_2); Utils.is_nat1(V2J.get(seqCompResult_2,i)))); + VDMSet set_2 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_2) && (\forall int i; 0 <= i && i < V2J.size(set_2); Utils.is_nat1(V2J.get(set_2,i)))); + for (Iterator iterator_2 = set_2.iterator(); iterator_2.hasNext();) { + Number x = ((Number) iterator_2.next()); + //@ assert Utils.is_nat1(x); + seqCompResult_2 = SeqUtil.conc(Utils.copy(seqCompResult_2), + SeqUtil.seq(x)); + + //@ assert (V2J.isSeq(seqCompResult_2) && (\forall int i; 0 <= i && i < V2J.size(seqCompResult_2); Utils.is_nat1(V2J.get(seqCompResult_2,i)))); + } + + { + VDMSeq ignorePattern_2 = Utils.copy(seqCompResult_2); + + //@ assert (V2J.isSeq1(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before violations"); + + VDMSeq seqCompResult_3 = SeqUtil.seq(); + + //@ assert (V2J.isSeq(seqCompResult_3) && (\forall int i; 0 <= i && i < V2J.size(seqCompResult_3); Utils.is_nat1(V2J.get(seqCompResult_3,i)))); + VDMSet set_3 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_3) && (\forall int i; 0 <= i && i < V2J.size(set_3); Utils.is_nat1(V2J.get(set_3,i)))); + for (Iterator iterator_3 = set_3.iterator(); iterator_3.hasNext();) { + Number x = ((Number) iterator_3.next()); + + //@ assert Utils.is_nat1(x); + if (x.longValue() > 4L) { + seqCompResult_3 = SeqUtil.conc(Utils.copy(seqCompResult_3), + SeqUtil.seq(x)); + + //@ assert (V2J.isSeq(seqCompResult_3) && (\forall int i; 0 <= i && i < V2J.size(seqCompResult_3); Utils.is_nat1(V2J.get(seqCompResult_3,i)))); + } + } + + { + VDMSeq ignorePattern_3 = Utils.copy(seqCompResult_3); + + //@ assert (V2J.isSeq1(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.get(ignorePattern_3,i)))); + + /* skip */ + } + + VDMSeq seqCompResult_4 = SeqUtil.seq(); + + //@ assert (V2J.isSeq(seqCompResult_4) && (\forall int i; 0 <= i && i < V2J.size(seqCompResult_4); Utils.is_nat(V2J.get(seqCompResult_4,i)))); + VDMSet set_4 = Entry.xs(); + + //@ assert (V2J.isSet(set_4) && (\forall int i; 0 <= i && i < V2J.size(set_4); Utils.is_nat(V2J.get(set_4,i)))); + for (Iterator iterator_4 = set_4.iterator(); iterator_4.hasNext();) { + Number x = ((Number) iterator_4.next()); + //@ assert Utils.is_nat(x); + seqCompResult_4 = SeqUtil.conc(Utils.copy(seqCompResult_4), + SeqUtil.seq(x)); + + //@ assert (V2J.isSeq(seqCompResult_4) && (\forall int i; 0 <= i && i < V2J.size(seqCompResult_4); Utils.is_nat(V2J.get(seqCompResult_4,i)))); + } + + { + VDMSeq ignorePattern_4 = Utils.copy(seqCompResult_4); + + //@ assert (V2J.isSeq1(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat(V2J.get(ignorePattern_4,i)))); + + /* skip */ + } + + IO.println("After violations"); + + return 0L; + } + + /*@ pure @*/ + public static VDMSet xs() { + VDMSet ret_1 = SetUtil.set(); + + //@ assert (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.get(ret_1,i)))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl new file mode 100644 index 0000000000..1974eb8e8b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl @@ -0,0 +1,28 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : seq1 of nat = [x | x in set {1,2,3} & x > 0] in skip; + let - : seq1 of nat = [x | x in set {1,2,3}] in skip; + IO`println("After legal use"); + IO`println("Before violations"); + let - : seq1 of nat = [x | x in set {1,2,3} & x > 4] in skip; + let - : seq1 of nat = [x | x in set xs()] in skip; + IO`println("After violations"); + return 0; +); + +functions + +xs : () -> set of nat +xs () == {}; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl.result new file mode 100644 index 0000000000..e09b9db87a --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl.result @@ -0,0 +1,10 @@ +"Before legal use" +"After legal use" +"Before violations" +Entry.java:91: JML assertion is false + //@ assert (V2J.isSeq1(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.get(ignorePattern_3,i)))); + ^ +Entry.java:114: JML assertion is false + //@ assert (V2J.isSeq1(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat(V2J.get(ignorePattern_4,i)))); + ^ +"After violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java new file mode 100644 index 0000000000..c554a8a0b4 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java @@ -0,0 +1,135 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before legal use"); + + VDMSet setCompResult_1 = SetUtil.set(); + + //@ assert (V2J.isSet(setCompResult_1) && (\forall int i; 0 <= i && i < V2J.size(setCompResult_1); Utils.is_nat1(V2J.get(setCompResult_1,i)))); + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_nat1(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext();) { + Number x = ((Number) iterator_1.next()); + + //@ assert Utils.is_nat1(x); + if (x.longValue() > 0L) { + setCompResult_1 = SetUtil.union(Utils.copy(setCompResult_1), + SetUtil.set(x)); + + //@ assert (V2J.isSet(setCompResult_1) && (\forall int i; 0 <= i && i < V2J.size(setCompResult_1); Utils.is_nat1(V2J.get(setCompResult_1,i)))); + } + } + + { + VDMSet ignorePattern_1 = Utils.copy(setCompResult_1); + + //@ assert (V2J.isSet(ignorePattern_1) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_1); Utils.is_nat1(V2J.get(ignorePattern_1,i)))); + + /* skip */ + } + + VDMSet setCompResult_2 = SetUtil.set(); + + //@ assert (V2J.isSet(setCompResult_2) && (\forall int i; 0 <= i && i < V2J.size(setCompResult_2); Utils.is_nat1(V2J.get(setCompResult_2,i)))); + VDMSet set_2 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_2) && (\forall int i; 0 <= i && i < V2J.size(set_2); Utils.is_nat1(V2J.get(set_2,i)))); + for (Iterator iterator_2 = set_2.iterator(); iterator_2.hasNext();) { + Number x = ((Number) iterator_2.next()); + //@ assert Utils.is_nat1(x); + setCompResult_2 = SetUtil.union(Utils.copy(setCompResult_2), + SetUtil.set(x)); + + //@ assert (V2J.isSet(setCompResult_2) && (\forall int i; 0 <= i && i < V2J.size(setCompResult_2); Utils.is_nat1(V2J.get(setCompResult_2,i)))); + } + + { + VDMSet ignorePattern_2 = Utils.copy(setCompResult_2); + + //@ assert (V2J.isSet(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat1(V2J.get(ignorePattern_2,i)))); + + /* skip */ + } + + IO.println("After legal use"); + IO.println("Before violations"); + + VDMSet setCompResult_3 = SetUtil.set(); + + //@ assert (V2J.isSet(setCompResult_3) && (\forall int i; 0 <= i && i < V2J.size(setCompResult_3); Utils.is_nat(V2J.get(setCompResult_3,i)))); + VDMSet set_3 = SetUtil.set(0L, 1L, 2L); + + //@ assert (V2J.isSet(set_3) && (\forall int i; 0 <= i && i < V2J.size(set_3); Utils.is_nat(V2J.get(set_3,i)))); + for (Iterator iterator_3 = set_3.iterator(); iterator_3.hasNext();) { + Number x = ((Number) iterator_3.next()); + + //@ assert Utils.is_nat(x); + if (x.longValue() > -1L) { + setCompResult_3 = SetUtil.union(Utils.copy(setCompResult_3), + SetUtil.set(x)); + + //@ assert (V2J.isSet(setCompResult_3) && (\forall int i; 0 <= i && i < V2J.size(setCompResult_3); Utils.is_nat(V2J.get(setCompResult_3,i)))); + } + } + + { + VDMSet ignorePattern_3 = Utils.copy(setCompResult_3); + + //@ assert (V2J.isSet(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat1(V2J.get(ignorePattern_3,i)))); + + /* skip */ + } + + VDMSet setCompResult_4 = SetUtil.set(); + + //@ assert (V2J.isSet(setCompResult_4) && (\forall int i; 0 <= i && i < V2J.size(setCompResult_4); Utils.is_nat(V2J.get(setCompResult_4,i)))); + VDMSet set_4 = SetUtil.set(0L, 1L, 2L); + + //@ assert (V2J.isSet(set_4) && (\forall int i; 0 <= i && i < V2J.size(set_4); Utils.is_nat(V2J.get(set_4,i)))); + for (Iterator iterator_4 = set_4.iterator(); iterator_4.hasNext();) { + Number x = ((Number) iterator_4.next()); + //@ assert Utils.is_nat(x); + setCompResult_4 = SetUtil.union(Utils.copy(setCompResult_4), + SetUtil.set(x)); + + //@ assert (V2J.isSet(setCompResult_4) && (\forall int i; 0 <= i && i < V2J.size(setCompResult_4); Utils.is_nat(V2J.get(setCompResult_4,i)))); + } + + { + VDMSet ignorePattern_4 = Utils.copy(setCompResult_4); + + //@ assert (V2J.isSet(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat1(V2J.get(ignorePattern_4,i)))); + + /* skip */ + } + + IO.println("After violations"); + + return 0L; + } + + /*@ pure @*/ + public static VDMSet xs() { + VDMSet ret_1 = SetUtil.set(); + + //@ assert (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.get(ret_1,i)))); + return Utils.copy(ret_1); + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl new file mode 100644 index 0000000000..bdf50a72fe --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl @@ -0,0 +1,28 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before legal use"); + let - : set of nat1 = {x| x in set {1,2,3} & x > 0} in skip; + let - : set of nat1 = {x| x in set {1,2,3}} in skip; + IO`println("After legal use"); + IO`println("Before violations"); + let - : set of nat1 = {x| x in set {0,1,2} & x > -1} in skip; + let - : set of nat1 = {x| x in set {0,1,2}} in skip; + IO`println("After violations"); + return 0; +); + +functions + +xs : () -> set of nat +xs () == {}; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl.result new file mode 100644 index 0000000000..b74e9a01cd --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl.result @@ -0,0 +1,10 @@ +"Before legal use" +"After legal use" +"Before violations" +Entry.java:91: JML assertion is false + //@ assert (V2J.isSet(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat1(V2J.get(ignorePattern_3,i)))); + ^ +Entry.java:114: JML assertion is false + //@ assert (V2J.isSet(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat1(V2J.get(ignorePattern_4,i)))); + ^ +"After violations" \ No newline at end of file From 0eea4de51693a5653c46975fb1357196387cea7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 11:19:00 +0200 Subject: [PATCH 196/706] Cleaning up comprehension tests --- .../dynamic_analysis/comprehension/Map/Entry.java | 8 -------- .../dynamic_analysis/comprehension/Map/Map.vdmsl | 5 ----- .../dynamic_analysis/comprehension/Set/Entry.java | 8 -------- .../dynamic_analysis/comprehension/Set/Set.vdmsl | 5 ----- 4 files changed, 26 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java index 7e75a24cad..dcce03b96f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java @@ -121,14 +121,6 @@ public static Object Run() { return 0L; } - /*@ pure @*/ - public static VDMSet xs() { - VDMSet ret_1 = SetUtil.set(); - - //@ assert (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.get(ret_1,i)))); - return Utils.copy(ret_1); - } - public String toString() { return "Entry{}"; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl index 51316448b9..51a1ee0c01 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl @@ -20,9 +20,4 @@ Run () == return 0; ); -functions - -xs : () -> set of nat -xs () == {}; - end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java index c554a8a0b4..37ab48c2cf 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java @@ -121,14 +121,6 @@ public static Object Run() { return 0L; } - /*@ pure @*/ - public static VDMSet xs() { - VDMSet ret_1 = SetUtil.set(); - - //@ assert (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_nat(V2J.get(ret_1,i)))); - return Utils.copy(ret_1); - } - public String toString() { return "Entry{}"; } diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl index bdf50a72fe..5e843fad2a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl @@ -20,9 +20,4 @@ Run () == return 0; ); -functions - -xs : () -> set of nat -xs () == {}; - end Entry \ No newline at end of file From 671e12331737d1fb5a7cc2f22604d1a47366f869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 17:04:25 +0200 Subject: [PATCH 197/706] Add test revealing problem with code generation of let-be-st when the pattern used is the ignore pattern --- .../pattern_specs/LetBeStIgnorePattern.vdmpp | 9 +++++ .../LetBeStIgnorePattern.vdmpp.eval.result | 6 ++++ .../LetBeStIgnorePattern.vdmpp.result | 34 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp create mode 100644 core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp.eval.result create mode 100644 core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp.result diff --git a/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp b/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp new file mode 100644 index 0000000000..e200726477 --- /dev/null +++ b/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp @@ -0,0 +1,9 @@ +class Entry + +operations + +public static Run : () ==> ? +Run () == + let - in set {1,2,3} in return 0; + +end Entry \ No newline at end of file diff --git a/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp.eval.result b/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp.eval.result new file mode 100644 index 0000000000..debd59b5fd --- /dev/null +++ b/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp.eval.result @@ -0,0 +1,6 @@ + + + + + + diff --git a/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp.result b/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp.result new file mode 100644 index 0000000000..500dc0db4a --- /dev/null +++ b/core/codegen/javagen/src/test/resources/pattern_specs/LetBeStIgnorePattern.vdmpp.result @@ -0,0 +1,34 @@ +import org.overture.codegen.runtime.*; + +import java.util.*; + + +@SuppressWarnings("all") +public class Entry { + public Entry() { + } + + public static Object Run() { + Number ignorePattern_1 = null; + Boolean success_1 = false; + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && !(success_1);) { + ignorePattern_1 = ((Number) iterator_1.next()); + success_1 = true; + } + + if (!(success_1)) { + throw new RuntimeException("Let Be St found no applicable bindings"); + } + + return 0L; + } + + public String toString() { + return "Entry{}"; + } +} + +########## From bff621cb8de6ddeb5fcd6d56ac499fccea188c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 17:05:03 +0200 Subject: [PATCH 198/706] Fix: missing handling of the ignore pattern for local pattern assignments --- .../org/overture/codegen/trans/patterns/PatternTrans.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/patterns/PatternTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/patterns/PatternTrans.java index d4113514fc..693f7ff98f 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/patterns/PatternTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/patterns/PatternTrans.java @@ -119,6 +119,14 @@ public void caseALocalPatternAssignmentStmCG( { return; } + + if (pattern instanceof AIgnorePatternCG) + { + AIdentifierPatternCG idPattern = getIdPattern(config.getIgnorePatternPrefix()); + transAssistant.replaceNodeWith(node.getTarget(), idPattern); + transAssistant.replaceNodeWith(pattern, idPattern.clone()); + return; + } DeclarationTag tag = fetchTag(node); From 6ec48f3b9169edfbdbbbdfe09ea0c3ed5e97a198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 17:55:01 +0200 Subject: [PATCH 199/706] Refactoring of naming prefixes for temporary variables added by the Java code generator --- .../codegen/vdm2java/JavaCodeGen.java | 5 ++- .../org/overture/codegen/ir/IRConstants.java | 17 --------- .../overture/codegen/trans/Exp2StmTrans.java | 15 ++++---- .../codegen/trans/Exp2StmVarPrefixes.java | 35 +++++++++++++++++++ 4 files changed, 44 insertions(+), 28 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java index 4ae92bb574..9891a1725a 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java @@ -64,7 +64,6 @@ import org.overture.codegen.cgast.declarations.AInterfaceDeclCG; import org.overture.codegen.cgast.declarations.AModuleDeclCG; import org.overture.codegen.ir.CodeGenBase; -import org.overture.codegen.ir.IRConstants; import org.overture.codegen.ir.IREventCoordinator; import org.overture.codegen.ir.IREventObserver; import org.overture.codegen.ir.IRStatus; @@ -78,7 +77,6 @@ import org.overture.codegen.trans.OldNameRenamer; import org.overture.codegen.trans.assistants.TransAssistantCG; import org.overture.codegen.utils.GeneralCodeGenUtils; -import org.overture.codegen.utils.GeneralUtils; import org.overture.codegen.utils.Generated; import org.overture.codegen.utils.GeneratedData; import org.overture.codegen.utils.GeneratedModule; @@ -785,7 +783,8 @@ private InvalidNamesResult validateVdmModelNames( Set reservedWordViolations = analysis.usesIllegalNames(mergedParseLists, new ReservedWordsComparison(IJavaConstants.RESERVED_WORDS, generator.getIRInfo(), INVALID_NAME_PREFIX)); Set typenameViolations = analysis.usesIllegalNames(mergedParseLists, new TypenameComparison(JAVA_RESERVED_TYPE_NAMES, generator.getIRInfo(), INVALID_NAME_PREFIX)); - String[] generatedTempVarNames = GeneralUtils.concat(IRConstants.GENERATED_TEMP_NAMES, varPrefixManager.getIteVarPrefixes().GENERATED_TEMP_NAMES); + //TODO: needs to take all of them into account + String[] generatedTempVarNames = varPrefixManager.getIteVarPrefixes().GENERATED_TEMP_NAMES; Set tempVarViolations = analysis.usesIllegalNames(mergedParseLists, new GeneratedVarComparison(generatedTempVarNames, generator.getIRInfo(), INVALID_NAME_PREFIX)); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRConstants.java b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRConstants.java index b257bdfd41..e77d407787 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRConstants.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/ir/IRConstants.java @@ -46,21 +46,4 @@ public class IRConstants "TestResult", "TestRunner", "VDMUtil", "CPU", "BUS" }; public static final String[] RESERVED_CLASS_NAMES = (String[]) ArrayUtils.addAll(new String[] { QUOTES_INTERFACE_NAME }, CLASS_NAMES_USED_IN_VDM); - - public static final String GENERATED_TEMP_SEQ_COMP_NAME_PREFIX = "seqCompResult_"; - public static final String GENERATED_TEMP_SET_COMP_NAME_PREFIX = "setCompResult_"; - public static final String GENERATED_TEMP_MAP_COMP_NAME_PREFIX = "mapCompResult_"; - public static final String GENERATED_TEMP_LET_BE_ST_EXP_NAME_PREFIX = "letBeStExp_"; - public static final String GENERATED_TEMP_FORALL_EXP_NAME_PREFIX = "forAllExpResult_"; - public static final String GENERATED_TEMP_EXISTS_EXP_NAME_PREFIX = "existsExpResult_"; - public static final String GENERATED_TEMP_EXISTS1_EXP_NAME_PREFIX = "exists1Counter_"; - - public static final String[] GENERATED_TEMP_NAMES = { - GENERATED_TEMP_SEQ_COMP_NAME_PREFIX, - GENERATED_TEMP_SET_COMP_NAME_PREFIX, - GENERATED_TEMP_MAP_COMP_NAME_PREFIX, - GENERATED_TEMP_LET_BE_ST_EXP_NAME_PREFIX, - GENERATED_TEMP_FORALL_EXP_NAME_PREFIX, - GENERATED_TEMP_EXISTS_EXP_NAME_PREFIX, - GENERATED_TEMP_EXISTS1_EXP_NAME_PREFIX }; } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java index d6d5f07d03..ce0baefe73 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java @@ -69,7 +69,6 @@ import org.overture.codegen.cgast.types.AIntNumericBasicTypeCG; import org.overture.codegen.cgast.types.SSetTypeCG; import org.overture.codegen.cgast.utils.AHeaderLetBeStCG; -import org.overture.codegen.ir.IRConstants; import org.overture.codegen.ir.ITempVarGen; import org.overture.codegen.trans.assistants.TransAssistantCG; import org.overture.codegen.trans.comp.ComplexCompStrategy; @@ -252,7 +251,7 @@ public void caseALetBeStExpCG(ALetBeStExpCG node) throws AnalysisException letBeStResult = transAssistant.getInfo().getExpAssistant().consNullExp(); } else { - String var = tempVarNameGen.nextVarName(IRConstants.GENERATED_TEMP_LET_BE_ST_EXP_NAME_PREFIX); + String var = tempVarNameGen.nextVarName(prefixes.letBeSt()); SExpCG value = node.getValue(); AVarDeclCG resultDecl = transAssistant.consDecl(var, value.getType().clone(), transAssistant.getInfo().getExpAssistant().consNullExp()); @@ -337,7 +336,7 @@ public void caseACompMapExpCG(ACompMapExpCG node) throws AnalysisException SExpCG predicate = node.getPredicate(); STypeCG type = node.getType(); ITempVarGen tempVarNameGen = transAssistant.getInfo().getTempVarNameGen(); - String var = tempVarNameGen.nextVarName(IRConstants.GENERATED_TEMP_MAP_COMP_NAME_PREFIX); + String var = tempVarNameGen.nextVarName(prefixes.mapComp()); ComplexCompStrategy strategy = new MapCompStrategy(transAssistant, first, predicate, var, type, langIterator, tempVarNameGen, iteVarPrefixes); @@ -370,7 +369,7 @@ public void caseACompSetExpCG(ACompSetExpCG node) throws AnalysisException SExpCG predicate = node.getPredicate(); STypeCG type = node.getType(); ITempVarGen tempVarNameGen = transAssistant.getInfo().getTempVarNameGen(); - String var = tempVarNameGen.nextVarName(IRConstants.GENERATED_TEMP_SET_COMP_NAME_PREFIX); + String var = tempVarNameGen.nextVarName(prefixes.setComp()); ComplexCompStrategy strategy = new SetCompStrategy(transAssistant, first, predicate, var, type, langIterator, tempVarNameGen, iteVarPrefixes); @@ -402,7 +401,7 @@ public void caseACompSeqExpCG(ACompSeqExpCG node) throws AnalysisException SExpCG predicate = node.getPredicate(); STypeCG type = node.getType(); ITempVarGen tempVarNameGen = transAssistant.getInfo().getTempVarNameGen(); - String var = tempVarNameGen.nextVarName(IRConstants.GENERATED_TEMP_SEQ_COMP_NAME_PREFIX); + String var = tempVarNameGen.nextVarName(prefixes.seqComp()); SeqCompStrategy strategy = new SeqCompStrategy(transAssistant, first, predicate, var, type, langIterator, tempVarNameGen, iteVarPrefixes); @@ -435,7 +434,7 @@ public void caseAForAllQuantifierExpCG(AForAllQuantifierExpCG node) SExpCG predicate = node.getPredicate(); ITempVarGen tempVarNameGen = transAssistant.getInfo().getTempVarNameGen(); - String var = tempVarNameGen.nextVarName(IRConstants.GENERATED_TEMP_FORALL_EXP_NAME_PREFIX); + String var = tempVarNameGen.nextVarName(prefixes.forAll()); OrdinaryQuantifierStrategy strategy = new OrdinaryQuantifierStrategy(transAssistant, predicate, var, OrdinaryQuantifier.FORALL, langIterator, tempVarNameGen, iteVarPrefixes); @@ -467,7 +466,7 @@ public void caseAExistsQuantifierExpCG(AExistsQuantifierExpCG node) SExpCG predicate = node.getPredicate(); ITempVarGen tempVarNameGen = transAssistant.getInfo().getTempVarNameGen(); - String var = tempVarNameGen.nextVarName(IRConstants.GENERATED_TEMP_EXISTS_EXP_NAME_PREFIX); + String var = tempVarNameGen.nextVarName(prefixes.exists()); OrdinaryQuantifierStrategy strategy = new OrdinaryQuantifierStrategy(transAssistant, predicate, var, OrdinaryQuantifier.EXISTS, langIterator, tempVarNameGen, iteVarPrefixes); @@ -499,7 +498,7 @@ public void caseAExists1QuantifierExpCG(AExists1QuantifierExpCG node) SExpCG predicate = node.getPredicate(); ITempVarGen tempVarNameGen = transAssistant.getInfo().getTempVarNameGen(); - String var = tempVarNameGen.nextVarName(IRConstants.GENERATED_TEMP_EXISTS1_EXP_NAME_PREFIX); + String var = tempVarNameGen.nextVarName(prefixes.exists1()); Exists1QuantifierStrategy strategy = new Exists1QuantifierStrategy(transAssistant, predicate, var, langIterator, tempVarNameGen, iteVarPrefixes, counterData); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmVarPrefixes.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmVarPrefixes.java index c990141cb4..92a57347d8 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmVarPrefixes.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmVarPrefixes.java @@ -26,4 +26,39 @@ public String recModExp() { return "recModifierExp_"; } + + public String seqComp() + { + return "seqCompResult_"; + } + + public String setComp() + { + return "setCompResult_"; + } + + public String mapComp() + { + return "mapCompResult_"; + } + + public String letBeSt() + { + return "letBeStExp_"; + } + + public String forAll() + { + return "forAllExpResult_"; + } + + public String exists() + { + return "existsExpResult_"; + } + + public String exists1() + { + return "exists1Counter_"; + } } From 2513f6a84043dfb81cac95a9d1c31ef12ceddb34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 20:21:29 +0200 Subject: [PATCH 200/706] Make the union type transformation take undefined expressions into account --- .../trans/uniontypes/UnionTypeTrans.java | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java index d87044d7f3..64245062c6 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java @@ -58,6 +58,7 @@ import org.overture.codegen.cgast.expressions.ANullExpCG; import org.overture.codegen.cgast.expressions.ARemNumericBinaryExpCG; import org.overture.codegen.cgast.expressions.ASeqConcatBinaryExpCG; +import org.overture.codegen.cgast.expressions.AUndefinedExpCG; import org.overture.codegen.cgast.expressions.SNumericBinaryExpCG; import org.overture.codegen.cgast.expressions.SUnaryExpCG; import org.overture.codegen.cgast.expressions.SVarExpBase; @@ -847,41 +848,54 @@ private ARaiseErrorStmCG consRaiseStm(String prefix, String fieldName) public void inAVarDeclCG(AVarDeclCG node) throws AnalysisException { - if(node.getExp() != null) + SExpCG exp = node.getExp(); + + if(exp != null) { - node.getExp().apply(this); + exp.apply(this); } - if(node.getType() instanceof AUnknownTypeCG || node.getExp() instanceof ANullExpCG) + STypeCG type = node.getType(); + + if(castNotNeeded(exp, type)) { return; } - if (!(node.getType() instanceof AUnionTypeCG)) + if (!(type instanceof AUnionTypeCG)) { - correctTypes(node.getExp(), node.getType()); + correctTypes(exp, type); } } @Override public void caseAAssignToExpStmCG(AAssignToExpStmCG node) throws AnalysisException { - if(node.getExp() != null) + SExpCG exp = node.getExp(); + + if(exp != null) { - node.getExp().apply(this); + exp.apply(this); } - if(node.getTarget().getType() instanceof AUnknownTypeCG || node.getExp() instanceof ANullExpCG) + STypeCG type = node.getTarget().getType(); + + if(castNotNeeded(exp, type)) { return; } - if (!(node.getTarget().getType() instanceof AUnionTypeCG)) + if (!(type instanceof AUnionTypeCG)) { - correctTypes(node.getExp(), node.getTarget().getType()); + correctTypes(exp, type); } } + private boolean castNotNeeded(SExpCG exp, STypeCG type) + { + return type instanceof AUnknownTypeCG || exp instanceof ANullExpCG || exp instanceof AUndefinedExpCG; + } + @Override public void caseAReturnStmCG(AReturnStmCG node) throws AnalysisException { From e145995a5327ef73079481be6e83e591930d58eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 20:28:16 +0200 Subject: [PATCH 201/706] Update expression assistant with more utility functionality --- .../codegen/assistant/ExpAssistantCG.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/ExpAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/ExpAssistantCG.java index bd192dbe99..7502fa9977 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/ExpAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/ExpAssistantCG.java @@ -58,6 +58,7 @@ import org.overture.codegen.cgast.expressions.ABoolIsExpCG; import org.overture.codegen.cgast.expressions.ABoolLiteralExpCG; import org.overture.codegen.cgast.expressions.ACaseAltExpExpCG; +import org.overture.codegen.cgast.expressions.ACastUnaryExpCG; import org.overture.codegen.cgast.expressions.ACharIsExpCG; import org.overture.codegen.cgast.expressions.ACharLiteralExpCG; import org.overture.codegen.cgast.expressions.AEnumSeqExpCG; @@ -81,6 +82,7 @@ import org.overture.codegen.cgast.expressions.AStringLiteralExpCG; import org.overture.codegen.cgast.expressions.ATokenIsExpCG; import org.overture.codegen.cgast.expressions.ATupleIsExpCG; +import org.overture.codegen.cgast.expressions.AUndefinedExpCG; import org.overture.codegen.cgast.expressions.SBinaryExpCG; import org.overture.codegen.cgast.expressions.SIsExpCG; import org.overture.codegen.cgast.expressions.SQuantifierExpCG; @@ -670,6 +672,14 @@ public SExpCG findSubject(SExpCG next) return next; } + public AUndefinedExpCG consUndefinedExp() + { + AUndefinedExpCG undefExp = new AUndefinedExpCG(); + undefExp.setType(new AUnknownTypeCG()); + + return undefExp; + } + public ANullExpCG consNullExp() { ANullExpCG nullExp = new ANullExpCG(); @@ -696,4 +706,20 @@ public STypeCG handleMapType(SMapTypeBase node, IRInfo question, boolean isInjec return mapType; } + + public boolean isUndefined(SExpCG exp) + { + if(exp instanceof ACastUnaryExpCG) + { + return isUndefined(((ACastUnaryExpCG) exp).getExp()); + } + else if(exp instanceof AUndefinedExpCG) + { + return true; + } + else + { + return false; + } + } } From 0696cf8a23d3c812f8e1cbd05363f955b91d01dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 20:31:45 +0200 Subject: [PATCH 202/706] Do not generate JML checks for 'undefined' variables --- .../main/java/org/overture/codegen/trans/Exp2StmTrans.java | 2 +- .../java/org/overture/codegen/trans/let/LetBeStStrategy.java | 2 +- .../overture/codegen/vdm2jml/predgen/TypePredHandler.java | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java index ce0baefe73..77f97e2e26 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java @@ -254,7 +254,7 @@ public void caseALetBeStExpCG(ALetBeStExpCG node) throws AnalysisException String var = tempVarNameGen.nextVarName(prefixes.letBeSt()); SExpCG value = node.getValue(); - AVarDeclCG resultDecl = transAssistant.consDecl(var, value.getType().clone(), transAssistant.getInfo().getExpAssistant().consNullExp()); + AVarDeclCG resultDecl = transAssistant.consDecl(var, value.getType().clone(), transAssistant.getInfo().getExpAssistant().consUndefinedExp()); outerBlock.getLocalDefs().add(resultDecl); AAssignToExpStmCG setLetBeStResult = new AAssignToExpStmCG(); diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/let/LetBeStStrategy.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/let/LetBeStStrategy.java index c958b61465..27c150feeb 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/let/LetBeStStrategy.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/let/LetBeStStrategy.java @@ -79,7 +79,7 @@ public List getOuterBlockDecls( { AVarDeclCG decl = transAssistant.getInfo().getDeclAssistant(). consLocalVarDecl(transAssistant.getSetTypeCloned(setType).getSetOf(), - id.clone(), transAssistant.getInfo().getExpAssistant().consNullExp()); + id.clone(), transAssistant.getInfo().getExpAssistant().consUndefinedExp()); decls.add(decl); outerBlockDecls.add(decl); } diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java index bd6ceb1c66..bdd1b5027d 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredHandler.java @@ -307,6 +307,11 @@ public List handleVarDecl(AVarDeclCG node) // let x : Even = 1 in ... // (dcl y : Even | nat := 2; ...) + if(getInfo().getExpAssistant().isUndefined(node.getExp())) + { + return null; + } + AbstractTypeInfo typeInfo = util.findTypeInfo(node.getType()); if (proceed(typeInfo)) From 2b913630fb989a9ac4ecfe712fddd2869e6d7b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 20:33:18 +0200 Subject: [PATCH 203/706] Prepare testing of JML generation of 'let-be-st' and related constructs --- .../tests/exec/JmlSelectorExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSelectorExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSelectorExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSelectorExecTests.java new file mode 100644 index 0000000000..d20710d625 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSelectorExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlSelectorExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "selector"; + + public static final String PROPERTY_ID = "selector"; + + public JmlSelectorExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From c56f1cc33da2c26b9e7a9d98855049d06a1cfb2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sun, 18 Oct 2015 20:35:17 +0200 Subject: [PATCH 204/706] Test JML generation of 'let-be-st' expressions and statements --- .../selector/LetBeStExp/Entry.java | 104 ++++++++++++++++++ .../selector/LetBeStExp/LetBeStExp.vdmsl | 28 +++++ .../LetBeStExp/LetBeStExp.vdmsl.result | 1 + .../selector/LetBeStStm/Entry.java | 74 +++++++++++++ .../selector/LetBeStStm/LetBeStStm.vdmsl | 18 +++ .../LetBeStStm/LetBeStStm.vdmsl.result | 1 + 6 files changed, 226 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/LetBeStExp.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/LetBeStExp.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/LetBeStStm.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/LetBeStStm.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/Entry.java new file mode 100644 index 0000000000..660c592589 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/Entry.java @@ -0,0 +1,104 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(); + + //@ assert Utils.is_nat(ignorePattern_1); + + /* skip */ + } + + { + Number ignorePattern_2 = g(); + + //@ assert Utils.is_nat(ignorePattern_2); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number f() { + Number letBeStExp_1 = null; + Number ignorePattern_3 = null; + + Boolean success_1 = false; + + //@ assert Utils.is_bool(success_1); + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_nat1(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && !(success_1);) { + ignorePattern_3 = ((Number) iterator_1.next()); + success_1 = true; + + //@ assert Utils.is_bool(success_1); + } + + if (!(success_1)) { + throw new RuntimeException("Let Be St found no applicable bindings"); + } + + letBeStExp_1 = 0L; + + //@ assert Utils.is_nat(letBeStExp_1); + Number ret_1 = letBeStExp_1; + + //@ assert Utils.is_nat(ret_1); + return ret_1; + } + + /*@ pure @*/ + public static Number g() { + Number letBeStExp_2 = null; + Number x = null; + + Boolean success_2 = false; + + //@ assert Utils.is_bool(success_2); + VDMSet set_2 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_2) && (\forall int i; 0 <= i && i < V2J.size(set_2); Utils.is_nat1(V2J.get(set_2,i)))); + for (Iterator iterator_2 = set_2.iterator(); + iterator_2.hasNext() && !(success_2);) { + x = ((Number) iterator_2.next()); + success_2 = x.longValue() > 1L; + + //@ assert Utils.is_bool(success_2); + } + + if (!(success_2)) { + throw new RuntimeException("Let Be St found no applicable bindings"); + } + + letBeStExp_2 = 0L; + + //@ assert Utils.is_nat(letBeStExp_2); + Number ret_2 = letBeStExp_2; + + //@ assert Utils.is_nat(ret_2); + return ret_2; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/LetBeStExp.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/LetBeStExp.vdmsl new file mode 100644 index 0000000000..6f8f0d1a6f --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/LetBeStExp.vdmsl @@ -0,0 +1,28 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + let - = g() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> nat +f () == + let - in set {1,2,3} in 0; + +g : () -> nat +g () == + let x in set {1,2,3} be st x > 1 in 0; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/LetBeStExp.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/LetBeStExp.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/LetBeStExp.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/Entry.java new file mode 100644 index 0000000000..171fc8fb8e --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/Entry.java @@ -0,0 +1,74 @@ +package project; + +import org.overture.codegen.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = null; + + Boolean success_1 = false; + + //@ assert Utils.is_bool(success_1); + VDMSet set_1 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_nat1(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && !(success_1);) { + ignorePattern_1 = ((Number) iterator_1.next()); + success_1 = true; + + //@ assert Utils.is_bool(success_1); + } + + if (!(success_1)) { + throw new RuntimeException( + "Let Be St found no applicable bindings"); + } + + /* skip */ + } + + { + Number x = null; + + Boolean success_2 = false; + + //@ assert Utils.is_bool(success_2); + VDMSet set_2 = SetUtil.set(1L, 2L, 3L); + + //@ assert (V2J.isSet(set_2) && (\forall int i; 0 <= i && i < V2J.size(set_2); Utils.is_nat1(V2J.get(set_2,i)))); + for (Iterator iterator_2 = set_2.iterator(); + iterator_2.hasNext() && !(success_2);) { + x = ((Number) iterator_2.next()); + success_2 = x.longValue() > 1L; + + //@ assert Utils.is_bool(success_2); + } + + if (!(success_2)) { + throw new RuntimeException( + "Let Be St found no applicable bindings"); + } + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/LetBeStStm.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/LetBeStStm.vdmsl new file mode 100644 index 0000000000..43f9fffc7d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/LetBeStStm.vdmsl @@ -0,0 +1,18 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - in set {1,2,3} in skip; + let x in set {1,2,3} be st x > 1 in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/LetBeStStm.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/LetBeStStm.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/LetBeStStm.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file From bae4d9c4b559d6bfd6c09fa7719e60d73aeab6eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 09:28:47 +0200 Subject: [PATCH 205/706] Add "VDM to JML Code Generation Runtime" maven project --- core/codegen/vdm2jml-runtime/pom.xml | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 core/codegen/vdm2jml-runtime/pom.xml diff --git a/core/codegen/vdm2jml-runtime/pom.xml b/core/codegen/vdm2jml-runtime/pom.xml new file mode 100644 index 0000000000..c8358d4e45 --- /dev/null +++ b/core/codegen/vdm2jml-runtime/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + + + org.overturetool.core + codegen + 2.3.1-SNAPSHOT + ../pom.xml + + + org.overturetool.core.codegen + vdm2jml-runtime + The VDM to JML Generator Runtime + + + + junit + junit + 4.11 + + + org.overturetool.core.codegen + codegen-runtime + ${project.version} + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + true + + **/*Test.java + **/*Test?.java + **/*TestSuite.java + + + + + + + From 41f5f581f25c4a6fc95d28afed599b936321e3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 12:54:36 +0200 Subject: [PATCH 206/706] Allow IR classes to have dependencies specified --- core/codegen/ir/src/main/resources/cg.astv2 | 1 + 1 file changed, 1 insertion(+) diff --git a/core/codegen/ir/src/main/resources/cg.astv2 b/core/codegen/ir/src/main/resources/cg.astv2 index 8438911c42..79e636ba6a 100644 --- a/core/codegen/ir/src/main/resources/cg.astv2 +++ b/core/codegen/ir/src/main/resources/cg.astv2 @@ -222,6 +222,7 @@ CG {-> package='org.overture.codegen.cgast' #Class {-> package='org.overture.codegen.cgast.declarations' | (globalMetaData):eString* | [package]:java_String + | (dependencies):eString* | [access]:java_String | [abstract]:java_Boolean | [static]:java_Boolean From 27354da773a9345c56a935f9aae19bbd51397b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 13:11:19 +0200 Subject: [PATCH 207/706] Add Java imports using a transformation --- .../codegen/vdm2java/ImportsTrans.java | 53 +++++++++++++++++++ .../overture/codegen/vdm2java/JavaFormat.java | 17 +++--- .../codegen/vdm2java/JavaTransSeries.java | 2 + .../JavaTemplates/Declarations/Class.vm | 14 ++--- .../codegen/assistant/DeclAssistantCG.java | 6 +++ 5 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/ImportsTrans.java diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/ImportsTrans.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/ImportsTrans.java new file mode 100644 index 0000000000..fa89ea5721 --- /dev/null +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/ImportsTrans.java @@ -0,0 +1,53 @@ +package org.overture.codegen.vdm2java; + +import java.util.LinkedList; +import java.util.List; + +import org.overture.ast.util.ClonableString; +import org.overture.codegen.cgast.analysis.AnalysisException; +import org.overture.codegen.cgast.analysis.DepthFirstAnalysisAdaptor; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; +import org.overture.codegen.ir.IRInfo; + +public class ImportsTrans extends DepthFirstAnalysisAdaptor +{ + private IRInfo info; + + public ImportsTrans(IRInfo info) + { + this.info = info; + } + + @Override + public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisException + { + List dep = new LinkedList<>(); + + if(!info.getDeclAssistant().isInnerClass(node)) + { + dep.add(new ClonableString("java.util.*")); + dep.add(new ClonableString("org.overture.codegen.runtime.*")); + } + else if(!info.getDeclAssistant().isInnerClass(node) && isQuote(node)) + { + dep.add(new ClonableString("org.overture.codegen.runtime.*")); + } + + if(importTraceSupport(node)) + { + dep.add(new ClonableString("org.overture.codegen.runtime.traces.*")); + } + + node.setDependencies(dep); + } + + public static boolean isQuote(ADefaultClassDeclCG classCg) + { + return classCg != null && "quotes".equals(classCg.getPackage()); + } + + public boolean importTraceSupport(ADefaultClassDeclCG node) + { + return info.getSettings().generateTraces() && !node.getTraces().isEmpty(); + } +} diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java index cdc5531b40..fed15b9b44 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java @@ -885,14 +885,9 @@ public String escapeChar(char c) public boolean isInnerClass(ADefaultClassDeclCG node) { - return node.parent() != null && node.parent().getAncestor(ADefaultClassDeclCG.class) != null; + return info.getDeclAssistant().isInnerClass(node); } - public static boolean isQuote(ADefaultClassDeclCG classCg) - { - return classCg != null && "quotes".equals(classCg.getPackage()); - } - public String formatStartStmExp(AStartStmCG node) throws AnalysisException { String str = format(node.getExp()); @@ -934,11 +929,6 @@ public static boolean isScoped(ABlockStmCG block) return block != null && block.getScoped() != null && block.getScoped(); } - public boolean importTraceSupport(ADefaultClassDeclCG node) - { - return info.getSettings().generateTraces() && !node.getTraces().isEmpty(); - } - public static boolean isMainClass(ADefaultClassDeclCG clazz) { return clazz != null && clazz.getTag() instanceof JavaMainTag; @@ -1009,4 +999,9 @@ public String genForIndexByVarName() { return info.getTempVarNameGen().nextVarName(varPrefixManager.getIteVarPrefixes().forIndexByVar()); } + + public static String getString(ClonableString c) + { + return c.value; + } } diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaTransSeries.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaTransSeries.java index 2147361334..35b8922ae4 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaTransSeries.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaTransSeries.java @@ -103,6 +103,7 @@ private List setupAnalysis() UnionTypeTrans unionTypeTr = new UnionTypeTrans(transAssist, unionTypePrefixes, codeGen.getJavaFormat().getValueSemantics().getCloneFreeNodes()); JavaToStringTrans javaToStringTr = new JavaToStringTrans(info); RecMethodsTrans recTr = new RecMethodsTrans(codeGen.getJavaFormat().getRecCreator()); + ImportsTrans impTr = new ImportsTrans(info); // Start concurrency transformations SentinelTrans sentinelTr = new SentinelTrans(info); @@ -136,6 +137,7 @@ private List setupAnalysis() series.add(seqConvTr); series.add(evalPermPredTr); series.add(recTr); + series.add(impTr); return series; } diff --git a/core/codegen/javagen/src/main/resources/JavaTemplates/Declarations/Class.vm b/core/codegen/javagen/src/main/resources/JavaTemplates/Declarations/Class.vm index f2170e68fe..c82df9e789 100644 --- a/core/codegen/javagen/src/main/resources/JavaTemplates/Declarations/Class.vm +++ b/core/codegen/javagen/src/main/resources/JavaTemplates/Declarations/Class.vm @@ -5,17 +5,9 @@ ## $package ## -#if (!$JavaFormat.isInnerClass($node)) -#**#import org.overture.codegen.runtime.*; -#**#import java.util.*; -#elseif ( !$JavaFormat.isInnerClass($node) && !$JavaFormat.isQuote($node)) -#**#import org.overture.codegen.runtime.*; -#end -## -#if ($JavaFormat.importTraceSupport($node)) -#**#import org.overture.codegen.runtime.traces.*;## -#end -## +#foreach( $dep in $node.getDependencies() ) +import ${JavaFormat.getString($dep)}; +#end## ## #set( $abstract = "") #if ($node.getAbstract()) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java index 513b329851..eab693a43c 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java @@ -51,6 +51,7 @@ import org.overture.codegen.cgast.SPatternCG; import org.overture.codegen.cgast.SStmCG; import org.overture.codegen.cgast.STypeCG; +import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; import org.overture.codegen.cgast.declarations.AFieldDeclCG; import org.overture.codegen.cgast.declarations.AFormalParamLocalParamCG; import org.overture.codegen.cgast.declarations.AFuncDeclCG; @@ -97,6 +98,11 @@ public DeclAssistantCG(AssistantManager assistantManager) super(assistantManager); } + public boolean isInnerClass(ADefaultClassDeclCG node) + { + return node.parent() != null && node.parent().getAncestor(ADefaultClassDeclCG.class) != null; + } + public T buildClass(SClassDefinition node, IRInfo question, T classCg) throws AnalysisException { String name = node.getName().getName(); From 439e68822b037bbb7f10ff455942acf7e51db405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 13:27:20 +0200 Subject: [PATCH 208/706] Add the JML to VDM runtime as a dependency --- core/codegen/vdm2jml/pom.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/pom.xml b/core/codegen/vdm2jml/pom.xml index 9664a4fa4c..4d25a60fbc 100644 --- a/core/codegen/vdm2jml/pom.xml +++ b/core/codegen/vdm2jml/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 @@ -18,6 +19,11 @@ javagen ${project.version} + + org.overturetool.core.codegen + vdm2jml-runtime + ${project.version} + org.overturetool.core.testing framework From 8bc0446742191aa8640ec6fdb7d777f240b1187b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 13:27:44 +0200 Subject: [PATCH 209/706] First version of VDM to JML runtime --- .../overture/codegen/vdm2jml/runtime/V2J.java | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java diff --git a/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java b/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java new file mode 100644 index 0000000000..99103bd106 --- /dev/null +++ b/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java @@ -0,0 +1,168 @@ +package org.overture.codegen.runtime; + +import java.util.Collection; +import java.util.HashSet; + +public class V2J +{ + public static boolean isInjMap(Object obj) + { + if(isMap(obj)) + { + VDMMap map = (VDMMap) obj; + @SuppressWarnings("unchecked") + HashSet values = new HashSet<>(map.values()); + return map.keySet().size() == values.size(); + } + else + { + return false; + } + } + + public static boolean isMap(Object obj) + { + return obj instanceof VDMMap; + } + + public static boolean isSet(Object obj) + { + return obj instanceof VDMSet; + } + + public static boolean isSeq(Object obj) + { + return obj instanceof VDMSeq; + } + + public static boolean isSeq1(Object obj) + { + if(obj instanceof VDMSeq) + { + VDMSeq seq = (VDMSeq) obj; + return !seq.isEmpty(); + } + else + { + return false; + } + } + + /*@ pure @*/ + public static VDMSeq toSeq(Object o) + { + if(o instanceof VDMSeq) + { + return (VDMSeq) o; + } + + throw new IllegalArgumentException("Method is only supported for " + VDMSeq.class); + } + + /*@ pure @*/ + public static Object get(Object col, int i) + { + if(col instanceof VDMSeq) + { + return ((VDMSeq) col).get(i); + } + else if(col instanceof VDMSet) + { + VDMSeq seq = set2seq(col); + return seq.get(i); + } + + throw new IllegalArgumentException("Method is only supported for " + VDMSeq.class + " and " + VDMSet.class); + } + + @SuppressWarnings("unchecked") + public static Object getDom(Object map, int i) + { + if(map instanceof VDMMap) + { + VDMMap cMap = (VDMMap) map; + //http://stackoverflow.com/questions/2923856/is-the-order-guaranteed-for-the-return-of-keys-and-values-from-a-linkedhashmap-o + + VDMSeq seq = SeqUtil.seq(); + seq.addAll(cMap.keySet()); + return seq.get(i); + } + + throw new IllegalArgumentException("Method is only supported for " + VDMMap.class); + } + + @SuppressWarnings("unchecked") + public static Object getRng(Object map, int i) + { + if(map instanceof VDMMap) + { + VDMMap cMap = (VDMMap) map; + + VDMSeq seq = SeqUtil.seq(); + seq.addAll(cMap.values()); + return seq.get(i); + } + + throw new IllegalArgumentException("Method is only supported for " + VDMMap.class); + } + + /*@ pure @*/ + public static int size(Object o) + { + // Covers sequences and sets + if(o instanceof Collection) + { + return ((Collection) o).size(); + } + + // Covers maps + if(o instanceof VDMMap) + { + return ((VDMMap) o).size(); + } + + throw new IllegalArgumentException("Method is only supported for " + Collection.class); + } + + @SuppressWarnings("unchecked") + /*@ pure @*/ + public static VDMSeq set2seq(Object set) + { + if(set instanceof VDMSet) + { + VDMSeq seq = SeqUtil.seq(); + seq.addAll((VDMSet) set); + return seq; + } + + throw new IllegalArgumentException("Method is only supported for " + VDMSet.class); + } + + /*@ pure @*/ + public static boolean isTup(Object subject, int size) + { + if(subject instanceof Tuple) + { + Tuple t = (Tuple) subject; + + return t.size() == size; + } + else + { + return false; + } + } + + /*@ pure @*/ + public static Object field(Object tup, int fieldNumber) + { + if(tup instanceof Tuple) + { + return ((Tuple) tup).get(fieldNumber); + } + else + { + throw new IllegalArgumentException("Method is only supported for " + Tuple.class); + } + } +} From 03eeca433082074cebe8bce5f8a13e9a112415a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 13:36:46 +0200 Subject: [PATCH 210/706] Add 'vdm2jml-runtime' to root pom --- core/codegen/pom.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/codegen/pom.xml b/core/codegen/pom.xml index 3b0cbe2603..2645e08029 100644 --- a/core/codegen/pom.xml +++ b/core/codegen/pom.xml @@ -3,21 +3,21 @@ 4.0.0 - core + core org.overturetool 2.3.1-SNAPSHOT ../pom.xml - pom + pom org.overturetool.core codegen Code Generation - - 1.6.6 + + 1.6.6 @@ -25,6 +25,7 @@ platform javagen vdm2jml + vdm2jml-runtime codegen-runtime codegen-maven-plugin From b2849483bf20c1ecf7c2256f75d5e665af4f9438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 13:37:35 +0200 Subject: [PATCH 211/706] Put VDM to JMl runtime in the right package --- .../java/org/overture/codegen/vdm2jml/runtime/V2J.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java b/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java index 99103bd106..f4520124b2 100644 --- a/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java +++ b/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java @@ -1,8 +1,14 @@ -package org.overture.codegen.runtime; +package org.overture.codegen.vdm2jml.runtime; import java.util.Collection; import java.util.HashSet; +import org.overture.codegen.runtime.SeqUtil; +import org.overture.codegen.runtime.Tuple; +import org.overture.codegen.runtime.VDMMap; +import org.overture.codegen.runtime.VDMSeq; +import org.overture.codegen.runtime.VDMSet; + public class V2J { public static boolean isInjMap(Object obj) From b7dc1388b05b997178c35885bf277be349340a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 13:45:21 +0200 Subject: [PATCH 212/706] Correct V2J imports --- .../codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java | 2 +- .../codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java | 2 +- .../java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java | 2 +- .../java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java | 2 +- .../java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java | 2 +- .../org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java | 2 +- .../src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java index f704ba4f63..f70e54ddf7 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractCollectionInfo.java @@ -3,8 +3,8 @@ import java.util.LinkedList; import java.util.List; -import org.overture.codegen.runtime.V2J; import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.runtime.V2J; import org.overture.codegen.vdm2jml.util.NameGen; public abstract class AbstractCollectionInfo extends AbstractTypeInfo diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java index a8c0299e25..96f9469d99 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/AbstractSetSeqInfo.java @@ -1,6 +1,6 @@ package org.overture.codegen.vdm2jml.predgen.info; -import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.runtime.V2J; import org.overture.codegen.vdm2jml.util.NameGen; public abstract class AbstractSetSeqInfo extends AbstractCollectionInfo diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java index c8b5c95272..ed146bdc36 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/MapInfo.java @@ -1,7 +1,7 @@ package org.overture.codegen.vdm2jml.predgen.info; -import org.overture.codegen.runtime.V2J; import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.runtime.V2J; import org.overture.codegen.vdm2jml.util.NameGen; public class MapInfo extends AbstractCollectionInfo diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java index 21ba052f52..b97753f43c 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SeqInfo.java @@ -1,6 +1,6 @@ package org.overture.codegen.vdm2jml.predgen.info; -import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.runtime.V2J; public class SeqInfo extends AbstractSetSeqInfo { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java index 493a6d7896..60cc73c3de 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/SetInfo.java @@ -1,6 +1,6 @@ package org.overture.codegen.vdm2jml.predgen.info; -import org.overture.codegen.runtime.V2J; +import org.overture.codegen.vdm2jml.runtime.V2J; public class SetInfo extends AbstractSetSeqInfo { diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java index 219dd5c03e..6567a65a93 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/TupleInfo.java @@ -3,8 +3,8 @@ import java.util.LinkedList; import java.util.List; -import org.overture.codegen.runtime.V2J; import org.overture.codegen.vdm2jml.JmlGenerator; +import org.overture.codegen.vdm2jml.runtime.V2J; import org.overture.codegen.vdm2jml.util.NameGen; public class TupleInfo extends AbstractTypeInfo diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java index 1850afc3de..aeb0f78372 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/V2JCallTests.java @@ -5,12 +5,12 @@ import org.junit.Assert; import org.junit.Test; -import org.overture.codegen.runtime.V2J; import org.overture.codegen.vdm2jml.predgen.info.AbstractSetSeqInfo; import org.overture.codegen.vdm2jml.predgen.info.MapInfo; import org.overture.codegen.vdm2jml.predgen.info.SeqInfo; import org.overture.codegen.vdm2jml.predgen.info.SetInfo; import org.overture.codegen.vdm2jml.predgen.info.TupleInfo; +import org.overture.codegen.vdm2jml.runtime.V2J; public class V2JCallTests { From 3d55d998c772f5b24eabf9573cff1d9b46c9cbec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 14:09:03 +0200 Subject: [PATCH 213/706] Fix 'isLocal' for variable expressions Assignment definitions are always local --- .../main/java/org/overture/codegen/visitor/ExpVisitorCG.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java index 098b9e2e6e..07fc36ceda 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java @@ -25,6 +25,7 @@ import java.util.List; import org.overture.ast.analysis.AnalysisException; +import org.overture.ast.definitions.AAssignmentDefinition; import org.overture.ast.definitions.AClassClassDefinition; import org.overture.ast.definitions.AInheritedDefinition; import org.overture.ast.definitions.AInstanceVariableDefinition; @@ -1308,7 +1309,7 @@ public SExpCG caseAVariableExp(AVariableExp node, IRInfo question) SClassDefinition owningClass = varDef.getAncestor(SClassDefinition.class); SClassDefinition nodeParentClass = node.getAncestor(SClassDefinition.class); - boolean isLocalDef = varDef.getNameScope() == NameScope.LOCAL; + boolean isLocalDef = varDef.getNameScope() == NameScope.LOCAL || varDef instanceof AAssignmentDefinition; boolean isInstanceVarDef = varDef instanceof AInstanceVariableDefinition; boolean isExplOp = varDef instanceof SOperationDefinition; boolean isExplFunc = varDef instanceof SFunctionDefinition; From ca3d2a23c6208e5af1fa133b34b1dbb62bfa7533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 14:45:49 +0200 Subject: [PATCH 214/706] Cleanup 'ImportsTrans' --- .../org/overture/codegen/vdm2java/ImportsTrans.java | 10 +++++----- .../org/overture/codegen/vdm2java/JavaCodeGen.java | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/ImportsTrans.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/ImportsTrans.java index fa89ea5721..70e12ca3cc 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/ImportsTrans.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/ImportsTrans.java @@ -25,17 +25,17 @@ public void caseADefaultClassDeclCG(ADefaultClassDeclCG node) throws AnalysisExc if(!info.getDeclAssistant().isInnerClass(node)) { - dep.add(new ClonableString("java.util.*")); - dep.add(new ClonableString("org.overture.codegen.runtime.*")); + dep.add(new ClonableString(JavaCodeGen.JAVA_UTIL)); + dep.add(new ClonableString(JavaCodeGen.RUNTIME_IMPORT)); } else if(!info.getDeclAssistant().isInnerClass(node) && isQuote(node)) { - dep.add(new ClonableString("org.overture.codegen.runtime.*")); + dep.add(new ClonableString(JavaCodeGen.RUNTIME_IMPORT)); } if(importTraceSupport(node)) { - dep.add(new ClonableString("org.overture.codegen.runtime.traces.*")); + dep.add(new ClonableString(JavaCodeGen.TRACE_IMPORT)); } node.setDependencies(dep); @@ -43,7 +43,7 @@ else if(!info.getDeclAssistant().isInnerClass(node) && isQuote(node)) public static boolean isQuote(ADefaultClassDeclCG classCg) { - return classCg != null && "quotes".equals(classCg.getPackage()); + return classCg != null && JavaCodeGen.JAVA_QUOTES_PACKAGE.equals(classCg.getPackage()); } public boolean importTraceSupport(ADefaultClassDeclCG node) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java index 9891a1725a..da2b45efe9 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaCodeGen.java @@ -84,6 +84,10 @@ public class JavaCodeGen extends CodeGenBase implements IREventCoordinator, IJavaQouteEventCoordinator { + public static final String TRACE_IMPORT = "org.overture.codegen.runtime.traces.*"; + public static final String RUNTIME_IMPORT = "org.overture.codegen.runtime.*"; + public static final String JAVA_UTIL = "java.util.*"; + public static final String JAVA_TEMPLATES_ROOT_FOLDER = "JavaTemplates"; public static final String[] JAVA_RESERVED_TYPE_NAMES = { From 81b63b002fb4d1fcdb88f937a2d414d5dc7fb15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 14:47:04 +0200 Subject: [PATCH 215/706] Update the JML generator to add the imports needed to the record classes --- .../main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java index 905a7f1352..cdebb9172b 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenUtil.java @@ -4,6 +4,7 @@ import java.util.LinkedList; import java.util.List; +import org.overture.ast.util.ClonableString; import org.overture.codegen.cgast.INode; import org.overture.codegen.cgast.SPatternCG; import org.overture.codegen.cgast.STypeCG; @@ -25,6 +26,7 @@ import org.overture.codegen.ir.IRStatus; import org.overture.codegen.ir.VdmNodeInfo; import org.overture.codegen.logging.Logger; +import org.overture.codegen.vdm2java.JavaCodeGen; import org.overture.codegen.vdm2java.JavaCodeGenUtil; import org.overture.codegen.vdm2java.JavaFormat; import org.overture.codegen.vdm2jml.data.RecClassInfo; @@ -301,6 +303,11 @@ public List> makeRecsOuterClasses(List> ast, Rec { recClass.setPackage(clazz.getName() + JavaFormat.TYPE_DECL_PACKAGE_SUFFIX); } + + List imports = new LinkedList<>(); + imports.add(new ClonableString(JavaCodeGen.JAVA_UTIL)); + imports.add(new ClonableString(JavaCodeGen.RUNTIME_IMPORT)); + recClass.setDependencies(imports); extraClasses.add(new IRStatus(recClass.getName(), recClass, new HashSet())); } From 9b5d11cf20cc9fd6303aaa106d56a20bce646f83 Mon Sep 17 00:00:00 2001 From: Nick Battle Date: Mon, 19 Oct 2015 13:53:40 +0100 Subject: [PATCH 216/706] SL trace definition reported as unused, fixes #476 --- .../visitor/TypeCheckerDefinitionVisitor.java | 3 ++ .../PP/access-types/access-types.vpp.result | 2 +- .../fulltest/PP/fundefpp/fundefpp.vpp.result | 2 +- .../PP/stmtpp/casesstmt/casesstmt.vpp.result | 2 +- .../stmtpp/rectrapstmt/rectrapstmt.vpp.result | 2 +- .../VICE/basicext/basicext-04.vpp.result | 2 +- .../VICE/extension/extension-05.vpp.result | 2 +- .../VICE/extension/extension-07.vpp.result | 2 +- .../expr/casesexpr/casesexpr-01.vdm.result | 2 +- .../expr/casesexpr/casesexpr-03.vdm.result | 2 +- .../SL/extexplopdef/extexplopdef.vdm.result | 2 +- .../SL/modules06/modules06.vdm.result | 4 +- .../fulltest/SL/opdef/opdef.vdm.result | 2 +- .../stmtsl/rectrapstmt/rectrapstmt.vdm.result | 4 +- .../SL/stmtsl/trapstmt/trapstmt.vdm.result | 2 +- .../src/test/resources/modules/ADTSL.result | 2 +- .../src/test/resources/modules/AlarmSL.result | 2 - .../resources/modules/cashdispenserSL.result | 1 - .../src/test/resources/modules/dwarfSL.result | 1 - .../test/resources/modules/newspeakSL.result | 40 +++++++++---------- .../test/resources/modules/simulatorSL.result | 8 ++-- .../test/resources/modules/trafficSL.result | 4 +- 22 files changed, 46 insertions(+), 47 deletions(-) diff --git a/core/typechecker/src/main/java/org/overture/typechecker/visitor/TypeCheckerDefinitionVisitor.java b/core/typechecker/src/main/java/org/overture/typechecker/visitor/TypeCheckerDefinitionVisitor.java index bd52bad63e..66331cf5a0 100644 --- a/core/typechecker/src/main/java/org/overture/typechecker/visitor/TypeCheckerDefinitionVisitor.java +++ b/core/typechecker/src/main/java/org/overture/typechecker/visitor/TypeCheckerDefinitionVisitor.java @@ -1295,6 +1295,9 @@ public PType caseANamedTraceDefinition(ANamedTraceDefinition node, typeCheck(term.getList(), THIS, new TypeCheckInfo(question.assistantFactory, question.env, NameScope.NAMESANDSTATE)); } + // Mark node as used, as traces are not used anyway + question.assistantFactory.createPDefinitionAssistant().markUsed(node); + return null; } diff --git a/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/access-types/access-types.vpp.result b/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/access-types/access-types.vpp.result index c56a32cb1f..e9ab11ce89 100644 --- a/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/access-types/access-types.vpp.result +++ b/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/access-types/access-types.vpp.result @@ -1,7 +1,7 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/fundefpp/fundefpp.vpp.result b/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/fundefpp/fundefpp.vpp.result index ca19dc2124..e2b9fbb2db 100644 --- a/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/fundefpp/fundefpp.vpp.result +++ b/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/fundefpp/fundefpp.vpp.result @@ -1,7 +1,7 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/stmtpp/casesstmt/casesstmt.vpp.result b/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/stmtpp/casesstmt/casesstmt.vpp.result index 6fa559fb0a..927769675c 100644 --- a/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/stmtpp/casesstmt/casesstmt.vpp.result +++ b/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/stmtpp/casesstmt/casesstmt.vpp.result @@ -7,8 +7,8 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/stmtpp/rectrapstmt/rectrapstmt.vpp.result b/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/stmtpp/rectrapstmt/rectrapstmt.vpp.result index e3ba3d1899..af8d924179 100644 --- a/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/stmtpp/rectrapstmt/rectrapstmt.vpp.result +++ b/core/typechecker/src/test/resources/Type_Check_PP_Classes_TestSuite_External/fulltest/PP/stmtpp/rectrapstmt/rectrapstmt.vpp.result @@ -4,8 +4,8 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/basicext/basicext-04.vpp.result b/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/basicext/basicext-04.vpp.result index 0d6cb38e41..84c567d193 100644 --- a/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/basicext/basicext-04.vpp.result +++ b/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/basicext/basicext-04.vpp.result @@ -1,8 +1,8 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/extension/extension-05.vpp.result b/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/extension/extension-05.vpp.result index 97fe22a5b6..31b03a562b 100644 --- a/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/extension/extension-05.vpp.result +++ b/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/extension/extension-05.vpp.result @@ -1,6 +1,6 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/extension/extension-07.vpp.result b/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/extension/extension-07.vpp.result index a78bf04f51..e18fee5190 100644 --- a/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/extension/extension-07.vpp.result +++ b/core/typechecker/src/test/resources/Type_Check_RT_Classes_TestSuite_External/VICE/extension/extension-07.vpp.result @@ -1,7 +1,7 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/exprtest/CORE/expr/casesexpr/casesexpr-01.vdm.result b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/exprtest/CORE/expr/casesexpr/casesexpr-01.vdm.result index 42d29f43e0..f33c2f8e50 100644 --- a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/exprtest/CORE/expr/casesexpr/casesexpr-01.vdm.result +++ b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/exprtest/CORE/expr/casesexpr/casesexpr-01.vdm.result @@ -1,7 +1,7 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/exprtest/CORE/expr/casesexpr/casesexpr-03.vdm.result b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/exprtest/CORE/expr/casesexpr/casesexpr-03.vdm.result index 93f5623800..77d4f4891c 100644 --- a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/exprtest/CORE/expr/casesexpr/casesexpr-03.vdm.result +++ b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/exprtest/CORE/expr/casesexpr/casesexpr-03.vdm.result @@ -1,7 +1,7 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/extexplopdef/extexplopdef.vdm.result b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/extexplopdef/extexplopdef.vdm.result index 8e497f58ee..c980ab0b69 100644 --- a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/extexplopdef/extexplopdef.vdm.result +++ b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/extexplopdef/extexplopdef.vdm.result @@ -1,8 +1,8 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/modules06/modules06.vdm.result b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/modules06/modules06.vdm.result index ff05d27a2d..70df24e1d3 100644 --- a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/modules06/modules06.vdm.result +++ b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/modules06/modules06.vdm.result @@ -1,10 +1,10 @@ - + - + diff --git a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/opdef/opdef.vdm.result b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/opdef/opdef.vdm.result index 870e59d0e9..7d855e0d72 100644 --- a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/opdef/opdef.vdm.result +++ b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/opdef/opdef.vdm.result @@ -4,8 +4,8 @@ - + diff --git a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/stmtsl/rectrapstmt/rectrapstmt.vdm.result b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/stmtsl/rectrapstmt/rectrapstmt.vdm.result index b11319d604..0d5b1edefc 100644 --- a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/stmtsl/rectrapstmt/rectrapstmt.vdm.result +++ b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/stmtsl/rectrapstmt/rectrapstmt.vdm.result @@ -4,12 +4,12 @@ - + - + diff --git a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/stmtsl/trapstmt/trapstmt.vdm.result b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/stmtsl/trapstmt/trapstmt.vdm.result index 18580e165f..3047541ba8 100644 --- a/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/stmtsl/trapstmt/trapstmt.vdm.result +++ b/core/typechecker/src/test/resources/Type_Check_SL_Modules_TestSuite_External/fulltest/SL/stmtsl/trapstmt/trapstmt.vdm.result @@ -6,8 +6,8 @@ - + diff --git a/core/typechecker/src/test/resources/modules/ADTSL.result b/core/typechecker/src/test/resources/modules/ADTSL.result index 234508d62c..2dbc22937f 100644 --- a/core/typechecker/src/test/resources/modules/ADTSL.result +++ b/core/typechecker/src/test/resources/modules/ADTSL.result @@ -6,8 +6,8 @@ - + diff --git a/core/typechecker/src/test/resources/modules/AlarmSL.result b/core/typechecker/src/test/resources/modules/AlarmSL.result index 1bf01357e7..d5426b04e7 100644 --- a/core/typechecker/src/test/resources/modules/AlarmSL.result +++ b/core/typechecker/src/test/resources/modules/AlarmSL.result @@ -7,7 +7,5 @@ - - diff --git a/core/typechecker/src/test/resources/modules/cashdispenserSL.result b/core/typechecker/src/test/resources/modules/cashdispenserSL.result index 50ca5577ff..4ce5df6290 100644 --- a/core/typechecker/src/test/resources/modules/cashdispenserSL.result +++ b/core/typechecker/src/test/resources/modules/cashdispenserSL.result @@ -5,7 +5,6 @@ - diff --git a/core/typechecker/src/test/resources/modules/dwarfSL.result b/core/typechecker/src/test/resources/modules/dwarfSL.result index 1ffa5b9651..c3c96be28c 100644 --- a/core/typechecker/src/test/resources/modules/dwarfSL.result +++ b/core/typechecker/src/test/resources/modules/dwarfSL.result @@ -1,7 +1,6 @@ - diff --git a/core/typechecker/src/test/resources/modules/newspeakSL.result b/core/typechecker/src/test/resources/modules/newspeakSL.result index aae48e8ca8..4be7e3c7f7 100644 --- a/core/typechecker/src/test/resources/modules/newspeakSL.result +++ b/core/typechecker/src/test/resources/modules/newspeakSL.result @@ -56,32 +56,32 @@ + - - + - + - + - - + + @@ -91,18 +91,18 @@ - + - + - + @@ -117,15 +117,15 @@ - - - + + + - + @@ -142,8 +142,8 @@ - + @@ -163,26 +163,26 @@ - - + - + + - + - + @@ -194,8 +194,8 @@ - + diff --git a/core/typechecker/src/test/resources/modules/simulatorSL.result b/core/typechecker/src/test/resources/modules/simulatorSL.result index 4a6c691dfd..dd1d5cfdd4 100644 --- a/core/typechecker/src/test/resources/modules/simulatorSL.result +++ b/core/typechecker/src/test/resources/modules/simulatorSL.result @@ -4,11 +4,11 @@ - - - + + + @@ -22,8 +22,8 @@ - + diff --git a/core/typechecker/src/test/resources/modules/trafficSL.result b/core/typechecker/src/test/resources/modules/trafficSL.result index 1b397b409e..21d5216b25 100644 --- a/core/typechecker/src/test/resources/modules/trafficSL.result +++ b/core/typechecker/src/test/resources/modules/trafficSL.result @@ -2,12 +2,12 @@ - + - + From e46d2fc2367731d32ea9f411facb0b4abb0be724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 14:58:11 +0200 Subject: [PATCH 217/706] Expect Java classes generated by the JML generator to import the VDM to JML runtime --- .../dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java | 1 + .../dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java | 1 + .../dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java | 1 + .../dynamic_analysis/atomic/AtomicStateInvViolation/St.java | 1 + .../dynamic_analysis/basictype/BoolReturnNil/Entry.java | 1 + .../dynamic_analysis/basictype/CharReturnNil/Entry.java | 1 + .../dynamic_analysis/basictype/IntAssignNonInt/Entry.java | 1 + .../dynamic_analysis/basictype/Nat1InitWithZero/Entry.java | 1 + .../resources/dynamic_analysis/basictype/NatParamNil/Entry.java | 1 + .../dynamic_analysis/basictype/QuoteAssignNil/Entry.java | 1 + .../dynamic_analysis/basictype/RatAssignBool/Entry.java | 1 + .../resources/dynamic_analysis/basictype/RealParamNil/Entry.java | 1 + .../dynamic_analysis/basictype/TokenAssignNil/Entry.java | 1 + .../complexstatedes/MaskedRecInvViolated/Entry.java | 1 + .../complexstatedes/MaskedRecInvViolated/R1.java | 1 + .../complexstatedes/MaskedRecInvViolated/R2.java | 1 + .../complexstatedes/MaskedRecInvViolated/R3.java | 1 + .../complexstatedes/MaskedRecInvViolated/R4.java | 1 + .../complexstatedes/MaskedRecNamedTypeInv/Entry.java | 1 + .../complexstatedes/MaskedRecNamedTypeInv/R1.java | 1 + .../complexstatedes/MaskedRecNamedTypeInv/R2.java | 1 + .../complexstatedes/MaskedRecNamedTypeInv/R3.java | 1 + .../complexstatedes/MaskedRecNamedTypeInv/R4.java | 1 + .../dynamic_analysis/complexstatedes/ModifyRecInMap/A.java | 1 + .../dynamic_analysis/complexstatedes/ModifyRecInMap/B.java | 1 + .../dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java | 1 + .../complexstatedes/NamedTypeInvUnionTypeRec/Entry.java | 1 + .../complexstatedes/NamedTypeInvUnionTypeRec/R1.java | 1 + .../complexstatedes/NamedTypeInvUnionTypeRec/R2.java | 1 + .../complexstatedes/NamedTypeInvUnionTypeRec/R3.java | 1 + .../complexstatedes/NamedTypeInvUnionTypeRec/R4.java | 1 + .../complexstatedes/NamedTypeInvUnionTypeRec/X.java | 1 + .../dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java | 1 + .../dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java | 1 + .../dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java | 1 + .../dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java | 1 + .../complexstatedes/RecInRecInvViolation/Entry.java | 1 + .../complexstatedes/RecInRecInvViolation/T1.java | 1 + .../complexstatedes/RecInRecInvViolation/T2.java | 1 + .../complexstatedes/RecInRecInvViolation/T3.java | 1 + .../complexstatedes/RecInRecInvViolation/T4.java | 1 + .../dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java | 1 + .../dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java | 1 + .../dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java | 1 + .../test/resources/dynamic_analysis/comprehension/Map/Entry.java | 1 + .../test/resources/dynamic_analysis/comprehension/Seq/Entry.java | 1 + .../test/resources/dynamic_analysis/comprehension/Set/Entry.java | 1 + .../dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java | 1 + .../dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java | 1 + .../dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java | 1 + .../maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java | 1 + .../maptype/ReturnNonInjMapWhereInjMapRequired/V2.java | 1 + .../namedtypeinv/NamedTypeInvAsssignments/Entry.java | 1 + .../namedtypeinv/NamedTypeInvAsssignments/St.java | 1 + .../namedtypeinv/NamedTypeInvLocalDecls/Entry.java | 1 + .../namedtypeinv/NamedTypeInvMapUpdate/Entry.java | 1 + .../namedtypeinv/NamedTypeInvMethodParam/Entry.java | 1 + .../namedtypeinv/NamedTypeInvNullAllowed/Entry.java | 1 + .../dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java | 1 + .../namedtypeinv/NamedTypeInvSeqUpdate/Entry.java | 1 + .../dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java | 1 + .../optionaltype/AssignBoolTypeViolation/Entry.java | 1 + .../optionaltype/FuncReturnTokenViolation/Entry.java | 1 + .../optionaltype/OpParamQuoteTypeViolation/Entry.java | 1 + .../optionaltype/VarDeclTypeViolation/Entry.java | 1 + .../test/resources/dynamic_analysis/prepost/PostCond/Entry.java | 1 + .../src/test/resources/dynamic_analysis/prepost/PostCond/St.java | 1 + .../test/resources/dynamic_analysis/prepost/PreCond/Entry.java | 1 + .../src/test/resources/dynamic_analysis/prepost/PreCond/St.java | 1 + .../test/resources/dynamic_analysis/quantifier/Exists/Entry.java | 1 + .../resources/dynamic_analysis/quantifier/Exists1/Entry.java | 1 + .../test/resources/dynamic_analysis/quantifier/ForAll/Entry.java | 1 + .../resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java | 1 + .../resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java | 1 + .../dynamic_analysis/recinv/StateInitViolatesInv/Entry.java | 1 + .../dynamic_analysis/recinv/StateInitViolatesInv/St.java | 1 + .../test/resources/dynamic_analysis/recinv/StateInv/Entry.java | 1 + .../src/test/resources/dynamic_analysis/recinv/StateInv/St.java | 1 + .../resources/dynamic_analysis/selector/LetBeStExp/Entry.java | 1 + .../resources/dynamic_analysis/selector/LetBeStStm/Entry.java | 1 + .../dynamic_analysis/seqtype/Seq1AssignEmptySet/Entry.java | 1 + .../seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java | 1 + .../test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java | 1 + .../seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java | 1 + .../dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java | 1 + .../dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java | 1 + .../test/resources/dynamic_analysis/settype/SetOfNat/Entry.java | 1 + .../resources/dynamic_analysis/settype/SetPassNill/Entry.java | 1 + .../tupletype/NatBoolBasedNamedTypeInv/Entry.java | 1 + .../dynamic_analysis/tupletype/NatBoolNegField/Entry.java | 1 + .../dynamic_analysis/tupletype/NatBoolTupNil/Entry.java | 1 + .../dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java | 1 + .../dynamic_analysis/uniontype/CharUnionEven/Entry.java | 1 + .../dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java | 1 + 94 files changed, 94 insertions(+) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java index 00670057ed..4c3fad0794 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java index 4682965df1..c6bb582eb8 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvNoViolation/St.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java index 1e7e8a652d..0936b35f40 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java index 4682965df1..c6bb582eb8 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/St.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java index cc68aba3db..3fe3994623 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java index ae1763c4b5..3d23130027 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/Entry.java index 1dfe06f7cc..e72f6fef1a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Entry.java index de1c3d5ebf..602e3540b4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java index 7118a9285a..c43027da68 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java index cd5a40a397..bc037fcfbe 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java index 93cba92d88..5a7fad4464 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java index ca549e9010..c7a281f377 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java index 892b3d087b..a192f5fc03 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java index adcda6c5d2..4365a82c47 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java index dcb71dc628..1f64af4bd9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R1.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java index cd132a3a64..a0f3cefc87 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R2.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java index bbc5bf05b5..0e3eeea0c9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R3.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java index 8d0f0d4174..f39083191a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/R4.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java index 7c240deda1..f6fc17cd84 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java index dcb71dc628..1f64af4bd9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R1.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java index cd132a3a64..a0f3cefc87 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R2.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java index bbc5bf05b5..0e3eeea0c9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R3.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java index 8d0f0d4174..f39083191a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/R4.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java index 906a4861ae..6a988e4bfe 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/A.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java index 48ce915cfa..e5c39e6585 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/B.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java index 3218493e31..0bb0c1eb58 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java index ce1e7ddcae..567da9b0dc 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java index 7466da7248..b324602831 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R1.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java index 0a70c0be20..f475670785 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R2.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java index 7496aa3fbe..8c0db7c5de 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R3.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java index 4df715d3e4..c45fc323c3 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/R4.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java index 89a4780943..d8d0ee8343 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/X.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java index 0439f4d7fc..3607a409f4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java index a3f778da25..1cb740e10d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R1.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java index 10004666da..0b594d461c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R2.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java index 04117836da..ecf523f817 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/R3.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java index 9cec65e792..5b03fe0dff 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java index 33008b4937..b6196663f0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T1.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java index 77dd63304c..ab307fc0d8 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T2.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java index 3523eedb78..bc37b30610 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T3.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java index a1e1ba1d4b..fef322a271 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/T4.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java index 906a4861ae..6a988e4bfe 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/A.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java index 48ce915cfa..e5c39e6585 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/B.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java index 14720605e6..d43b1cba1f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java index dcce03b96f..1f76df6a9f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Entry.java index ca108cc341..3dd7d23284 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java index 37ab48c2cf..1f61b19fac 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java index 20d7f246d4..937ff26ec6 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java index 1c7f6c0bfe..0c01b28cd7 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java index 5e9a7964e6..bba81f4abc 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java index f69f0a3e1d..c564fa20be 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/V2.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/V2.java index 50930851e4..b32f29502d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/V2.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/V2.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java index 82d04f7c16..581d85a8f3 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java index 49e10a4809..ee1dd017aa 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/St.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java index 5abe4ad9c2..9ecb622662 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java index f51bbf2e30..9629325de1 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java index 760d0b8ed6..7005950f9d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java index 683ef3a4b9..64e0a9221f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvNullAllowed/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java index d67efc0bc7..c57aa16b0c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java index ab94ed4b8a..2ab36654b4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java index bb6b10f38f..caf672658d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java index f9986fd44a..76e77ce1eb 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java index 59fae0a6e0..944348c633 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java index ef1fd69463..24f3658fa1 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java index c507bed2d0..5e990b9d47 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java index e4f492aa23..31d9a2e3b8 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java index 56744ad1ab..06f5376ce0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/St.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java index b674311072..4f4f2fc965 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java index bb677b0e7d..b4e03efeaa 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/St.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Entry.java index 0fbcdf329e..66709053e3 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists1/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists1/Entry.java index cd1a237fdd..b164ca146a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists1/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/Exists1/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/Entry.java index 39472e84b0..e3dd65c513 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/quantifier/ForAll/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java index 8954eaf64c..ef4ab43fcb 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java index e1187a1c8e..7641d85f83 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/Rec.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/Entry.java index 7a54ab81c9..138c8c913f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java index bde4a8a6a9..0221e28e9f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/St.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java index c499846552..fbd0d215e8 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java index bde4a8a6a9..0221e28e9f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/St.java @@ -1,6 +1,7 @@ package project.Entrytypes; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/Entry.java index 660c592589..166e362af9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStExp/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/Entry.java index 171fc8fb8e..1e096eab25 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/LetBeStStm/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Entry.java index d2aa4c8409..c836265ea2 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java index 29a7b7318b..8acd0c1e12 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java index 278ddfe049..2fbeef1e0c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java index 4b0eccd25b..b9bd9e0228 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java index 2d4cd40623..17b82fe598 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java index 8343cd959b..286b63f9be 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/Entry.java index cd94387314..97631f67b4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/Entry.java index 815376989a..eaa401d897 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java index 169b79a22a..dbfeb9c03e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java index e24df812e2..4de2fe666c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java index fd8ef2e59e..1fd308d990 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java index 99be9e7c98..7b87c4606d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java index f42fd38cdc..eaa1e6148b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java index c524a61092..6973bc99cb 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/Entry.java @@ -1,6 +1,7 @@ package project; import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; import java.util.*; From a83ea14727b3f224370e04a082bec3a0d8fd08ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 16:25:21 +0200 Subject: [PATCH 218/706] Expect line numbers of JML execution traces to change --- .../AtomicStateInvViolation.vdmsl.result | 4 +- .../BoolReturnNil/BoolReturnNil.vdmsl.result | 2 +- .../CharReturnNil/CharReturnNil.vdmsl.result | 2 +- .../IntAssignNonInt.vdmsl.result | 2 +- .../Nat1InitWithZero.vdmsl.result | 2 +- .../NatParamNil/NatParamNil.vdmsl.result | 4 +- .../QuoteAssignNil.vdmsl.result | 2 +- .../RatAssignBool/RatAssignBool.vdmsl.result | 2 +- .../RealParamNil/RealParamNil.vdmsl.result | 2 +- .../TokenAssignNil.vdmsl.result | 2 +- .../MaskedRecInvViolated.vdmsl.result | 110 +++++++++--------- .../MaskedRecNamedTypeInv.vdmsl.result | 2 +- .../ModifyRecInMap.vdmsl.result | 4 +- .../NamedTypeInvUnionTypeRec.vdmsl.result | 12 +- .../RecInRecInAtomic.vdmsl.result | 4 +- .../RecInRecInvViolation.vdmsl.result | 68 +++++------ .../RecWithMapOfRec.vdmsl.result | 4 +- .../comprehension/Map/Map.vdmsl.result | 4 +- .../comprehension/Seq/Seq.vdmsl.result | 4 +- .../comprehension/Set/Set.vdmsl.result | 4 +- .../AssignNonInjMapToInjMap.vdmsl.result | 2 +- .../MapBoolToNatAssignNil.vdmsl.result | 2 +- .../MapBoolToNatDetectNegInt.vdmsl.result | 2 +- ...nNonInjMapWhereInjMapRequired.vdmsl.result | 4 +- .../NamedTypeInvAsssignments.vdmsl.result | 6 +- .../NamedTypeInvLocalDecls.vdmsl.result | 2 +- .../NamedTypeInvMapUpdate.vdmsl.result | 2 +- .../NamedTypeInvMethodParam.vdmsl.result | 2 +- .../NamedTypeInvReturn.vdmsl.result | 6 +- .../NamedTypeInvSeqUpdate.vdmsl.result | 2 +- .../NamedTypeInvValues.vdmsl.result | 10 +- .../AssignBoolTypeViolation.vdmsl.result | 2 +- .../FuncReturnTokenViolation.vdmsl.result | 4 +- .../OpParamQuoteTypeViolation.vdmsl.result | 2 +- .../VarDeclTypeViolation.vdmsl.result | 2 +- .../prepost/PostCond/PostCond.vdmsl.result | 4 +- .../prepost/PreCond/PreCond.vdmsl.result | 4 +- .../RecTypeDefInv/RecTypeDefInv.vdmsl.result | 4 +- .../StateInitViolatesInv.vdmsl.result | 2 +- .../recinv/StateInv/StateInv.vdmsl.result | 8 +- .../Seq1AssignEmptySet.vdmsl.result | 2 +- ...1EvenNatsMaskedAsNamedTypeInv.vdmsl.result | 4 +- .../seqtype/SeqEven/SeqEven.vdmsl.result | 2 +- ...qNat1BoolMaskedAsNamedTypeInv.vdmsl.result | 2 +- .../SeqOfNatNilElem.vdmsl.result | 2 +- .../SetEvenNamedTypeInv.vdmsl.result | 2 +- .../settype/SetOfNat/SetOfNat.vdmsl.result | 2 +- .../SetPassNill/SetPassNil.vdmsl.result | 6 +- .../NatBooolBasedNamedTypeInv.vdmsl.result | 4 +- .../NatBoolNegField.vdmsl.result | 2 +- .../NatBoolTupNil/NatBoolTupNil.vdmsl.result | 2 +- .../TupleSizeMismatch.vdmsl.result | 2 +- .../CharUnionEven/CharUnionEven.vdmsl.result | 2 +- .../OptionalBasicUnion.vdmsl.result | 2 +- 54 files changed, 174 insertions(+), 174 deletions(-) diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result index 425de969b9..f948aed500 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/atomic/AtomicStateInvViolation/AtomicStateInvViolation.vdmsl.result @@ -1,8 +1,8 @@ "Before first atomic (expecting violation after atomic)" -St.java:63: JML invariant is false on leaving method project.Entrytypes.St.valid() +St.java:64: JML invariant is false on leaving method project.Entrytypes.St.valid() public Boolean valid() { ^ -St.java:13: Associated declaration +St.java:14: Associated declaration //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); ^ "After first atomic (expected violation before this print statement)" diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl.result index e8eec9e41c..7423f15a77 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/BoolReturnNil/BoolReturnNil.vdmsl.result @@ -1,7 +1,7 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:24: JML assertion is false +Entry.java:25: JML assertion is false //@ assert Utils.is_bool(b); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl.result index 4ed8da7b17..d8a840de19 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/CharReturnNil/CharReturnNil.vdmsl.result @@ -1,7 +1,7 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert Utils.is_char(ignorePattern_2); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl.result index 93fbf2d905..ca88b32650 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/IntAssignNonInt/IntAssignNonInt.vdmsl.result @@ -1,7 +1,7 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:24: JML assertion is false +Entry.java:25: JML assertion is false //@ assert Utils.is_int(i); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl.result index 41bc1d7b9e..df92d26f6e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/Nat1InitWithZero/Nat1InitWithZero.vdmsl.result @@ -1,7 +1,7 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:27: JML assertion is false +Entry.java:28: JML assertion is false //@ assert Utils.is_nat1(n1); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl.result index 9765d810e2..837999d676 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/NatParamNil/NatParamNil.vdmsl.result @@ -1,10 +1,10 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:34: JML assertion is false +Entry.java:35: JML assertion is false //@ assert Utils.is_nat(x); ^ -Entry.java:37: JML assertion is false +Entry.java:38: JML assertion is false //@ assert Utils.is_nat(ret_1); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl.result index 8943dc678d..0638660c78 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/QuoteAssignNil/QuoteAssignNil.vdmsl.result @@ -1,7 +1,7 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert Utils.is_(a,project.quotes.AQuote.class); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl.result index d7b24eb63d..3bf328152b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RatAssignBool/RatAssignBool.vdmsl.result @@ -1,7 +1,7 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:24: JML assertion is false +Entry.java:25: JML assertion is false //@ assert Utils.is_rat(i); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl.result index b55957f217..281879d3b4 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/RealParamNil/RealParamNil.vdmsl.result @@ -1,7 +1,7 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:31: JML assertion is false +Entry.java:32: JML assertion is false //@ assert Utils.is_real(ignorePattern_1); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl.result index 00fb4a6df3..c8f37852fc 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/basictype/TokenAssignNil/TokenAssignNil.vdmsl.result @@ -1,7 +1,7 @@ "Before valid use." "After valid use." "Before invalid use." -Entry.java:38: JML assertion is false +Entry.java:39: JML assertion is false //@ assert Utils.is_token(ignorePattern_2); ^ "After invalid use." \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result index bffa6a165c..eb9baa0ed3 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecInvViolated/MaskedRecInvViolated.vdmsl.result @@ -1,169 +1,169 @@ "Before useOk" "After useOk" "Before useNotOk" -Entry.java:177: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:178: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) return !(Utils.equals(t3.get_r4().get_x(), 10L)); ^ -Entry.java:177: +Entry.java:178: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:49: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() public project.Entrytypes.R4 get_r4() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:48: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:49: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:63: JML invariant is false on leaving method project.Entrytypes.R3.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:64: JML invariant is false on leaving method project.Entrytypes.R3.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:63: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:64: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: JML invariant is false +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML caller invariant is false on leaving calling method (Parameter: _t3, Caller: project.Entrytypes.R2.inv_R2(project.Entrytypes.R3), Callee: org.overture.codegen.runtime.Utils.equals(java.lang.Object,java.lang.Object)) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: JML invariant is false on leaving method project.Entrytypes.R2.inv_R2(project.Entrytypes.R3) (parameter _t3) public static Boolean inv_R2(final project.Entrytypes.R3 _t3) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/MaskedRecInvViolated/project/Entrytypes/R2.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result index 7f05835ce5..edba025206 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/MaskedRecNamedTypeInv/MaskedRecNamedTypeInv.vdmsl.result @@ -1,7 +1,7 @@ "Before useOk" "After useOk" "Before useNotOk" -Entry.java:128: JML assertion is false +Entry.java:129: JML assertion is false //@ assert (Utils.is_(stateDes_8,project.Entrytypes.R3.class) && inv_Entry_T3(stateDes_8)); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result index 4bb33c862b..86408a328a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/ModifyRecInMap/ModifyRecInMap.vdmsl.result @@ -1,10 +1,10 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:63: JML invariant is false on leaving method project.Entrytypes.A.valid() +A.java:64: JML invariant is false on leaving method project.Entrytypes.A.valid() public Boolean valid() { ^ -A.java:13: Associated declaration +A.java:14: Associated declaration //@ public instance invariant project.Entry.invChecksOn ==> inv_A(m); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result index e1c066ba14..45be847afc 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/NamedTypeInvUnionTypeRec/NamedTypeInvUnionTypeRec.vdmsl.result @@ -1,22 +1,22 @@ "Before useOk" "After useOk" "Before useNotOk" -Entry.java:223: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) +Entry.java:224: JML invariant is false on entering method project.Entrytypes.R3.get_r4() from project.Entry.inv_Entry_T3(java.lang.Object) apply_9 = ((project.Entrytypes.R3) t3).get_r4(); ^ -Entry.java:223: +Entry.java:224: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:49: JML invariant is false on leaving method project.Entrytypes.R3.get_r4() public project.Entrytypes.R4 get_r4() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:48: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:49: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:63: JML invariant is false on leaving method project.Entrytypes.R3.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:64: JML invariant is false on leaving method project.Entrytypes.R3.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:63: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/NamedTypeInvUnionTypeRec/project/Entrytypes/R3.java:64: //@ public instance invariant project.Entry.invChecksOn ==> inv_R3(r4); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result index 39690ca462..c672c06bab 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInAtomic/RecInRecInAtomic.vdmsl.result @@ -1,10 +1,10 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: JML invariant is false on leaving method project.Entrytypes.R1.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:64: JML invariant is false on leaving method project.Entrytypes.R1.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:63: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInAtomic/project/Entrytypes/R1.java:64: //@ public instance invariant project.Entry.invChecksOn ==> inv_R1(r2); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result index 8cf3dc26c9..3ec47deeae 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecInRecInvViolation/RecInRecInvViolation.vdmsl.result @@ -1,106 +1,106 @@ "Before useOk" "After useOk" "Before useNotOk" -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: JML invariant is false on leaving method project.Entrytypes.T2.valid() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:64: JML invariant is false on leaving method project.Entrytypes.T2.valid() public Boolean valid() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:63: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:64: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: JML invariant is false +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:48: JML invariant is false on leaving method project.Entrytypes.T1.get_t2() (for result type) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:49: JML invariant is false on leaving method project.Entrytypes.T1.get_t2() (for result type) public project.Entrytypes.T2 get_t2() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:48: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:49: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: JML invariant is false +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML caller invariant is false on leaving calling method (Parameter: _t2, Caller: project.Entrytypes.T1.inv_T1(project.Entrytypes.T2), Callee: java.lang.Number.longValue()) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: JML invariant is false on leaving method project.Entrytypes.T1.inv_T1(project.Entrytypes.T2) (parameter _t2) public static Boolean inv_T1(final project.Entrytypes.T2 _t2) { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:69: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T1.java:70: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -Entry.java:93: JML invariant is false on entering method project.Entrytypes.T2.get_t3() from project.Entry.useNotOk() +Entry.java:94: JML invariant is false on entering method project.Entrytypes.T2.get_t3() from project.Entry.useNotOk() project.Entrytypes.T3 stateDes_11 = stateDes_10.get_t3(); ^ -Entry.java:93: +Entry.java:94: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:48: JML invariant is false on leaving method project.Entrytypes.T2.get_t3() +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:49: JML invariant is false on leaving method project.Entrytypes.T2.get_t3() public project.Entrytypes.T3 get_t3() { ^ -/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:13: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:48: +/home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:14: Associated declaration: /home/peter/dev/ovtrepo/core/codegen/vdm2jml/target/jml/code/RecInRecInvViolation/project/Entrytypes/T2.java:49: //@ public instance invariant project.Entry.invChecksOn ==> inv_T2(t3); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result index b30dfb410a..329df425e0 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/complexstatedes/RecWithMapOfRec/RecWithMapOfRec.vdmsl.result @@ -1,10 +1,10 @@ "Before useOk" "After useOk" "Before useNotOk" -A.java:55: JML invariant is false on leaving method project.Entrytypes.A.set_m(org.overture.codegen.runtime.VDMMap) +A.java:56: JML invariant is false on leaving method project.Entrytypes.A.set_m(org.overture.codegen.runtime.VDMMap) public void set_m(final VDMMap _m) { ^ -A.java:13: Associated declaration +A.java:14: Associated declaration //@ public instance invariant project.Entry.invChecksOn ==> inv_A(m); ^ "After useNotOk" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl.result index 2fc97a15b1..5916c673b7 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Map/Map.vdmsl.result @@ -1,10 +1,10 @@ "Before legal use" "After legal use" "Before violations" -Entry.java:91: JML assertion is false +Entry.java:92: JML assertion is false //@ assert (V2J.isInjMap(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.getDom(ignorePattern_3,i)) && Utils.is_nat(V2J.getRng(ignorePattern_3,i)))); ^ -Entry.java:114: JML assertion is false +Entry.java:115: JML assertion is false //@ assert (V2J.isInjMap(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat(V2J.getDom(ignorePattern_4,i)) && Utils.is_nat(V2J.getRng(ignorePattern_4,i)))); ^ "After violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl.result index e09b9db87a..2463f888ba 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Seq/Seq.vdmsl.result @@ -1,10 +1,10 @@ "Before legal use" "After legal use" "Before violations" -Entry.java:91: JML assertion is false +Entry.java:92: JML assertion is false //@ assert (V2J.isSeq1(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.get(ignorePattern_3,i)))); ^ -Entry.java:114: JML assertion is false +Entry.java:115: JML assertion is false //@ assert (V2J.isSeq1(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat(V2J.get(ignorePattern_4,i)))); ^ "After violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl.result index b74e9a01cd..06c470b99d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/comprehension/Set/Set.vdmsl.result @@ -1,10 +1,10 @@ "Before legal use" "After legal use" "Before violations" -Entry.java:91: JML assertion is false +Entry.java:92: JML assertion is false //@ assert (V2J.isSet(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat1(V2J.get(ignorePattern_3,i)))); ^ -Entry.java:114: JML assertion is false +Entry.java:115: JML assertion is false //@ assert (V2J.isSet(ignorePattern_4) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_4); Utils.is_nat1(V2J.get(ignorePattern_4,i)))); ^ "After violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl.result index de4f907fac..9c0918b05b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/AssignNonInjMapToInjMap/AssignNonInjMapToInjMap.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:34: JML assertion is false +Entry.java:35: JML assertion is false //@ assert (V2J.isInjMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl.result index 30abf72aa8..aa5f8cb426 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatAssignNil/MapBoolToNatAssignNil.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:33: JML assertion is false +Entry.java:34: JML assertion is false //@ assert (V2J.isMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_bool(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl.result index 30abf72aa8..aa5f8cb426 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/MapBoolToNatDetectNegInt/MapBoolToNatDetectNegInt.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:33: JML assertion is false +Entry.java:34: JML assertion is false //@ assert (V2J.isMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_bool(V2J.getDom(ignorePattern_2,i)) && Utils.is_nat(V2J.getRng(ignorePattern_2,i)))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl.result index 7587edd80d..ad0e4c94b3 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/maptype/ReturnNonInjMapWhereInjMapRequired/ReturnNonInjMapWhereInjMapRequired.vdmsl.result @@ -1,10 +1,10 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:59: JML assertion is false +Entry.java:60: JML assertion is false //@ assert (V2J.isInjMap(ret_2) && (\forall int i; 0 <= i && i < V2J.size(ret_2); Utils.is_nat(V2J.getDom(ret_2,i)) && Utils.is_(V2J.getRng(ret_2,i),project.Entrytypes.V2.class))); ^ -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert (V2J.isInjMap(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.getDom(ignorePattern_2,i)) && Utils.is_(V2J.getRng(ignorePattern_2,i),project.Entrytypes.V2.class))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result index 1a4723606f..56e3b8dff1 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvAsssignments/NamedTypeInvAsssignments.vdmsl.result @@ -1,11 +1,11 @@ "Breaking named type invariant (assigning record field)" -St.java:55: JML assertion is false +St.java:56: JML assertion is false //@ assert project.Entry.invChecksOn ==> (((_x == null) || ((_x == null) || ((_x == null) || ((_x == null) || Utils.is_nat(_x)) && inv_Entry_PossiblyOne(_x)) || (Utils.is_bool(_x) && inv_Entry_True(_x))) && inv_Entry_PT(_x))); ^ -St.java:58: JML assertion is false +St.java:59: JML assertion is false //@ assert project.Entry.invChecksOn ==> (((x == null) || ((x == null) || ((x == null) || ((x == null) || Utils.is_nat(x)) && inv_Entry_PossiblyOne(x)) || (Utils.is_bool(x) && inv_Entry_True(x))) && inv_Entry_PT(x))); ^ "Breaking named type invariant (assigning local variable)" -Entry.java:50: JML assertion is false +Entry.java:51: JML assertion is false //@ assert ((p1 == null) || ((p1 == null) || ((p1 == null) || ((p1 == null) || Utils.is_nat(p1)) && inv_Entry_PossiblyOne(p1)) || (Utils.is_bool(p1) && inv_Entry_True(p1))) && inv_Entry_PT(p1)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result index 6570442959..60ffd7dabd 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvLocalDecls/NamedTypeInvLocalDecls.vdmsl.result @@ -1,5 +1,5 @@ "Before breaking named type invariant" -Entry.java:34: JML assertion is false +Entry.java:35: JML assertion is false //@ assert (((Utils.is_nat(notLarge) && inv_Entry_Even(notLarge)) || (Utils.is_real(notLarge) && inv_Entry_Large(notLarge))) && inv_Entry_No(notLarge)); ^ "After breaking named type invariant" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result index 2ed81a853c..55fafa5e8a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMapUpdate/NamedTypeInvMapUpdate.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for sequence" -Entry.java:30: JML assertion is false +Entry.java:31: JML assertion is false //@ assert ((V2J.isMap(m) && (\forall int i; 0 <= i && i < V2J.size(m); true && true)) && inv_Entry_M(m)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result index 6d1dffc995..87fe962ce5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvMethodParam/NamedTypeInvMethodParam.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for method parameter" -Entry.java:49: JML assertion is false +Entry.java:50: JML assertion is false //@ assert (Utils.is_nat(c) && inv_Entry_Even(c)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result index 11eb8bdd91..e666b5d256 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvReturn/NamedTypeInvReturn.vdmsl.result @@ -1,10 +1,10 @@ "Breaking named type invariant for return value" -Entry.java:56: JML assertion is false +Entry.java:57: JML assertion is false //@ assert ((a == null) || ((a == null) || (Utils.is_real(a) && inv_Entry_B(a)) || (Utils.is_char(a) && inv_Entry_C(a))) && inv_Entry_A(a)); ^ -Entry.java:59: JML assertion is false +Entry.java:60: JML assertion is false //@ assert ((ret_2 == null) || ((ret_2 == null) || (Utils.is_real(ret_2) && inv_Entry_B(ret_2)) || (Utils.is_char(ret_2) && inv_Entry_C(ret_2))) && inv_Entry_A(ret_2)); ^ -Entry.java:36: JML assertion is false +Entry.java:37: JML assertion is false //@ assert ((ignorePattern_6 == null) || ((ignorePattern_6 == null) || (Utils.is_real(ignorePattern_6) && inv_Entry_B(ignorePattern_6)) || (Utils.is_char(ignorePattern_6) && inv_Entry_C(ignorePattern_6))) && inv_Entry_A(ignorePattern_6)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result index cc7f059410..c96f22b1f9 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvSeqUpdate/NamedTypeInvSeqUpdate.vdmsl.result @@ -1,4 +1,4 @@ "Breaking named type invariant for sequence" -Entry.java:30: JML assertion is false +Entry.java:31: JML assertion is false //@ assert ((V2J.isSeq(s) && (\forall int i; 0 <= i && i < V2J.size(s); true)) && inv_Entry_S(s)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/NamedTypeInvValues.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/NamedTypeInvValues.vdmsl.result index 485268ea2c..ffda1a194c 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/NamedTypeInvValues.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeInvValues/NamedTypeInvValues.vdmsl.result @@ -1,18 +1,18 @@ -Entry.java:10: JML static initialization may not be correct +Entry.java:11: JML static initialization may not be correct final public class Entry { ^ -Entry.java:14: Associated declaration +Entry.java:15: Associated declaration //@ public static invariant (((Utils.is_char(fBreak) && inv_Entry_C(fBreak)) || (Utils.is_nat(fBreak) && inv_Entry_N(fBreak))) && inv_Entry_CN(fBreak)); ^ Main.java:7: JML invariant is false on entering method project.Entry.Run() from Main.main(java.lang.String[]) project.Entry.Run(); ^ -Entry.java:14: Associated declaration +Entry.java:15: Associated declaration //@ public static invariant (((Utils.is_char(fBreak) && inv_Entry_C(fBreak)) || (Utils.is_nat(fBreak) && inv_Entry_N(fBreak))) && inv_Entry_CN(fBreak)); ^ -Entry.java:21: JML invariant is false on leaving method project.Entry.Run() +Entry.java:22: JML invariant is false on leaving method project.Entry.Run() public static Object Run() { ^ -Entry.java:14: Associated declaration +Entry.java:15: Associated declaration //@ public static invariant (((Utils.is_char(fBreak) && inv_Entry_C(fBreak)) || (Utils.is_nat(fBreak) && inv_Entry_N(fBreak))) && inv_Entry_CN(fBreak)); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result index 3c33804286..6b15a0a5f8 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/AssignBoolTypeViolation/AssignBoolTypeViolation.vdmsl.result @@ -1,7 +1,7 @@ "Before doing valid assignments" "After doing valid assignments" "Before doing illegal assignments" -Entry.java:31: JML assertion is false +Entry.java:32: JML assertion is false //@ assert Utils.is_bool(b); ^ "After doing illegal assignments" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result index d3c69e6ebb..32d5ccae60 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/FuncReturnTokenViolation/FuncReturnTokenViolation.vdmsl.result @@ -1,10 +1,10 @@ "Before evaluating ok()" "After evaluating ok()" "Before evaluating error()" -Entry.java:60: JML assertion is false +Entry.java:61: JML assertion is false //@ assert Utils.is_token(ret_2); ^ -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert Utils.is_token(ignorePattern_2); ^ "After evaluating error()" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result index c95f55429e..2d8f5de25d 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/OpParamQuoteTypeViolation/OpParamQuoteTypeViolation.vdmsl.result @@ -1,7 +1,7 @@ "Before passing LEGAL value" "After passing LEGAL value" "Before passing ILLEGAL value" -Entry.java:34: JML assertion is false +Entry.java:35: JML assertion is false //@ assert Utils.is_(ignorePattern_1,project.quotes.AQuote.class); ^ "After passing ILLEGAL value" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result index 674bc418ec..11845e9f07 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/optionaltype/VarDeclTypeViolation/VarDeclTypeViolation.vdmsl.result @@ -1,7 +1,7 @@ "Before VALID initialisation" "After VALID initialisation" "Before INVALID initialisation" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert Utils.is_nat(bError); ^ "After INVALID initialisation" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/PostCond.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/PostCond.vdmsl.result index 10ba9330d4..7fc9b0ff93 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/PostCond.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PostCond/PostCond.vdmsl.result @@ -1,8 +1,8 @@ "Before breaking post condition" -Entry.java:49: JML postcondition is false +Entry.java:50: JML postcondition is false public static Number opRet(final Number a) { ^ -Entry.java:48: Associated declaration +Entry.java:49: Associated declaration //@ ensures post_opRet(a,\result,\old(St.copy()),St); ^ "After breaking post condition" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/PreCond.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/PreCond.vdmsl.result index e5edc4759b..588f3e6c12 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/PreCond.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/prepost/PreCond/PreCond.vdmsl.result @@ -1,8 +1,8 @@ "Before breaking pre condition" -Entry.java:26: JML precondition is false +Entry.java:27: JML precondition is false Number ignorePattern_2 = id(-1L); ^ -Entry.java:60: Associated declaration +Entry.java:61: Associated declaration //@ requires pre_id(a); ^ "After breaking pre condition" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/RecTypeDefInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/RecTypeDefInv.vdmsl.result index 010c1953ed..649b6bf52e 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/RecTypeDefInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/RecTypeDefInv/RecTypeDefInv.vdmsl.result @@ -1,8 +1,8 @@ "Before breaking record invariant" -Rec.java:15: JML invariant is false on leaving method project.Entrytypes.Rec.Rec(java.lang.Number,java.lang.Number) +Rec.java:16: JML invariant is false on leaving method project.Entrytypes.Rec.Rec(java.lang.Number,java.lang.Number) public Rec(final Number _x, final Number _y) { ^ -Rec.java:14: Associated declaration +Rec.java:15: Associated declaration //@ public instance invariant project.Entry.invChecksOn ==> inv_Rec(x,y); ^ "After breaking record invariant" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/StateInitViolatesInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/StateInitViolatesInv.vdmsl.result index 15edca64e4..3d7f49afea 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/StateInitViolatesInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInitViolatesInv/StateInitViolatesInv.vdmsl.result @@ -1,3 +1,3 @@ -St.java:13: JML invariant is false +St.java:14: JML invariant is false //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); ^ \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result index ff94b2cea9..e45867acc6 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/recinv/StateInv/StateInv.vdmsl.result @@ -1,14 +1,14 @@ "Before breaking state invariant" -St.java:55: JML invariant is false on leaving method project.Entrytypes.St.set_x(java.lang.Number) +St.java:56: JML invariant is false on leaving method project.Entrytypes.St.set_x(java.lang.Number) public void set_x(final Number _x) { ^ -St.java:13: Associated declaration +St.java:14: Associated declaration //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); ^ -Entry.java:52: JML invariant is false on entering method project.Entrytypes.St.set_x(java.lang.Number) from project.Entry.op() +Entry.java:53: JML invariant is false on entering method project.Entrytypes.St.set_x(java.lang.Number) from project.Entry.op() St.set_x(10L); ^ -St.java:13: Associated declaration +St.java:14: Associated declaration //@ public instance invariant project.Entry.invChecksOn ==> inv_St(x); ^ "After breaking state invariant" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result index 837082952b..92bf824fff 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1AssignEmptySet/Seq1AssignEmptySet.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert (V2J.isSeq1(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result index e723e56146..f23398219f 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/Seq1EvenNatsMaskedAsNamedTypeInv/Seq1EvenNatsMaskedAsNamedTypeInv.vdmsl.result @@ -1,10 +1,10 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert ((V2J.isSeq1(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))) && inv_Entry_Seq1Even(ignorePattern_2)); ^ -Entry.java:40: JML assertion is false +Entry.java:41: JML assertion is false //@ assert ((V2J.isSeq1(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); Utils.is_nat(V2J.get(ignorePattern_3,i)))) && inv_Entry_Seq1Even(ignorePattern_3)); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl.result index 3543746b17..3c8540fef5 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqEven/SeqEven.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:40: JML assertion is false +Entry.java:41: JML assertion is false //@ assert ((V2J.isSeq(ignorePattern_3) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_3); (Utils.is_nat(V2J.get(ignorePattern_3,i)) && inv_Entry_Even(V2J.get(ignorePattern_3,i))))) && inv_Entry_SeqEven(ignorePattern_3)); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl.result index 475875325d..a8d95ebe5b 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqNat1BoolMaskedAsNamedTypeInv/SeqNat1BoolMaskedAsNamedTypeInv.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert ((V2J.isSeq(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); (Utils.is_bool(V2J.get(ignorePattern_2,i)) || Utils.is_nat1(V2J.get(ignorePattern_2,i))))) && inv_Entry_SeqNat1Bool(ignorePattern_2)); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl.result index 6b4450b9dd..19478b6d7a 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/seqtype/SeqOfNatNilElem/SeqOfNatNilElem.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal uses" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert (V2J.isSeq(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); ^ "After illegal uses" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl.result index 222264febd..2c84b77ad3 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetEvenNamedTypeInv/SetEvenNamedTypeInv.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:39: JML assertion is false +Entry.java:40: JML assertion is false //@ assert ((V2J.isSet(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); (Utils.is_nat(V2J.get(ignorePattern_2,i)) && inv_Entry_Even(V2J.get(ignorePattern_2,i))))) && inv_Entry_SetEven(ignorePattern_2)); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl.result index f51cf4f7a2..59802be1bb 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetOfNat/SetOfNat.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert (V2J.isSet(ignorePattern_2) && (\forall int i; 0 <= i && i < V2J.size(ignorePattern_2); Utils.is_nat(V2J.get(ignorePattern_2,i)))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl.result index 81759baac2..69a0805195 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/settype/SetPassNill/SetPassNil.vdmsl.result @@ -1,13 +1,13 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:47: JML assertion is false +Entry.java:48: JML assertion is false //@ assert (V2J.isSet(xs) && (\forall int i; 0 <= i && i < V2J.size(xs); Utils.is_bool(V2J.get(xs,i)))); ^ -Entry.java:50: JML assertion is false +Entry.java:51: JML assertion is false //@ assert (V2J.isSet(ret_1) && (\forall int i; 0 <= i && i < V2J.size(ret_1); Utils.is_bool(V2J.get(ret_1,i)))); ^ -Entry.java:35: JML assertion is false +Entry.java:36: JML assertion is false //@ assert (V2J.isSet(r) && (\forall int i; 0 <= i && i < V2J.size(r); Utils.is_bool(V2J.get(r,i)))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result index c6b370e30b..15bef2aa27 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolBasedNamedTypeInv/NatBooolBasedNamedTypeInv.vdmsl.result @@ -1,10 +1,10 @@ "Before legal use" "After legal use" "Before illegal uses" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert ((V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))) && inv_Entry_TrueEven(ignorePattern_2)); ^ -Entry.java:40: JML assertion is false +Entry.java:41: JML assertion is false //@ assert ((V2J.isTup(ignorePattern_3,2) && Utils.is_nat(V2J.field(ignorePattern_3,0)) && Utils.is_bool(V2J.field(ignorePattern_3,1))) && inv_Entry_TrueEven(ignorePattern_3)); ^ "After illegal uses" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result index a1004bc8a6..eae0bc6580 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolNegField/NatBoolNegField.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert (V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result index a1004bc8a6..eae0bc6580 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/NatBoolTupNil/NatBoolTupNil.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert (V2J.isTup(ignorePattern_2,2) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_bool(V2J.field(ignorePattern_2,1))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl.result index e47fcc5eca..e21125df72 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/tupletype/TupleSizeMismatch/TupleSizeMismatch.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert (V2J.isTup(ignorePattern_2,4) && Utils.is_nat(V2J.field(ignorePattern_2,0)) && Utils.is_nat(V2J.field(ignorePattern_2,1)) && Utils.is_char(V2J.field(ignorePattern_2,2)) && Utils.is_bool(V2J.field(ignorePattern_2,3))); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result index e0e76e2df5..06cb5c7e19 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/CharUnionEven/CharUnionEven.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:32: JML assertion is false +Entry.java:33: JML assertion is false //@ assert ((Utils.is_nat(ignorePattern_2) && inv_Entry_Even(ignorePattern_2)) || Utils.is_char(ignorePattern_2)); ^ "After illegal use" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl.result index d5ca06b0da..50b3972588 100644 --- a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl.result +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/uniontype/OptionalBasicUnion/OptionalBasicUnion.vdmsl.result @@ -1,7 +1,7 @@ "Before legal use" "After legal use" "Before illegal use" -Entry.java:44: JML assertion is false +Entry.java:45: JML assertion is false //@ assert (Utils.is_bool(a) || Utils.is_char(a) || Utils.is_nat1(a)); ^ "After illegal use" \ No newline at end of file From 85eb34d1ee0a922d31fe0a5f259587922ea5109b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 16:26:33 +0200 Subject: [PATCH 219/706] Java quote classes must import the Java code generation runtime --- .../overture/codegen/vdm2java/JavaQuoteValueCreator.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java index f41d414da1..238cc8d72e 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaQuoteValueCreator.java @@ -1,5 +1,9 @@ package org.overture.codegen.vdm2java; +import java.util.LinkedList; +import java.util.List; + +import org.overture.ast.util.ClonableString; import org.overture.codegen.cgast.SExpCG; import org.overture.codegen.cgast.STypeCG; import org.overture.codegen.cgast.declarations.ADefaultClassDeclCG; @@ -68,6 +72,10 @@ public ADefaultClassDeclCG consQuoteValue(String quoteClassName, String quoteNam decl.getMethods().add(consEqualsMethod(quoteClassName)); decl.getMethods().add(consToStringMethod(quoteName)); + List imports = new LinkedList<>(); + imports.add(new ClonableString(JavaCodeGen.RUNTIME_IMPORT)); + decl.setDependencies(imports); + return decl; } From 8e72c9409a22faeed2dfb7eec85b8f02d8679af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 16:28:46 +0200 Subject: [PATCH 220/706] Update JML execution tests to use the VDM to JML runtime --- core/codegen/vdm2jml/pom.xml | 9 +++++++++ .../overture/vdm2jml/tests/JmlPassTypeCheckTests.java | 7 ++++--- .../overture/vdm2jml/tests/OpenJmlValidationBase.java | 11 +++++++++-- .../overture/vdm2jml/tests/exec/JmlExecTestBase.java | 11 ++++++----- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/core/codegen/vdm2jml/pom.xml b/core/codegen/vdm2jml/pom.xml index 4d25a60fbc..237e20ade2 100644 --- a/core/codegen/vdm2jml/pom.xml +++ b/core/codegen/vdm2jml/pom.xml @@ -75,6 +75,15 @@ ${basedir}/target/jml/lib codegen-runtime.jar + + org.overturetool.core.codegen + vdm2jml-runtime + ${project.version} + jar + true + ${basedir}/target/jml/lib + vdm2jml-runtime.jar + diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPassTypeCheckTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPassTypeCheckTests.java index 9dafd5f853..ee4d558e91 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPassTypeCheckTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/JmlPassTypeCheckTests.java @@ -71,9 +71,10 @@ public String[] getTypeCheckArgs() // -check // - return new String[] { JavaToolsUtils.JAVA, JavaToolsUtils.JAR_ARG, - openJml.getAbsolutePath(), IOpenJmlConsts.CP_ARG, - cgRuntime.getAbsolutePath(), IOpenJmlConsts.TC }; + return new String[] { JavaToolsUtils.JAVA, JavaToolsUtils.JAR_ARG, openJml.getAbsolutePath(), + IOpenJmlConsts.CP_ARG, + "\"" + cgRuntime.getAbsolutePath() + File.pathSeparator + vdm2jmlRuntime.getAbsolutePath() + "\"", + IOpenJmlConsts.TC }; } @Override diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OpenJmlValidationBase.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OpenJmlValidationBase.java index c74ace3c31..f5cd768fd2 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OpenJmlValidationBase.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/OpenJmlValidationBase.java @@ -21,10 +21,15 @@ abstract public class OpenJmlValidationBase extends JmlGenTestBase public static final String JML_RUNTIME = "jmlruntime.jar"; - public static final String CODEGEN_RUNTIME = TEST_EXEC_FOLDER_PATH - + File.separatorChar + "lib" + File.separatorChar + public static final String TEST_EXEC_LIB_FOLDER_PATH = TEST_EXEC_FOLDER_PATH + + File.separatorChar + "lib"; + + public static final String CODEGEN_RUNTIME = TEST_EXEC_LIB_FOLDER_PATH + File.separatorChar + "codegen-runtime.jar"; + public static final String VDM_TO_JML_RUNTIME = TEST_EXEC_LIB_FOLDER_PATH + File.separatorChar + + "vdm2jml-runtime.jar"; + public static final String EXEC_PROPERTY = "tests.vdm2jml.openjml"; public static final int EXIT_OK = 0; @@ -32,10 +37,12 @@ abstract public class OpenJmlValidationBase extends JmlGenTestBase protected File openJml; protected File jmlRuntime; protected File cgRuntime; + protected File vdm2jmlRuntime; public OpenJmlValidationBase(File inputFile) { super(inputFile); this.cgRuntime = new File(CODEGEN_RUNTIME); + this.vdm2jmlRuntime = new File(VDM_TO_JML_RUNTIME); setOpenJmlTools(); } diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java index a7c7583e8c..516ffa659a 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlExecTestBase.java @@ -207,11 +207,11 @@ protected String[] getTypeCheckArgs(File genJavaFolder) // -no-purityCheck // - String[] openJmlConfig = new String[] { JavaToolsUtils.JAVA, - JavaToolsUtils.JAR_ARG, openJml.getAbsolutePath(), - IOpenJmlConsts.CP_ARG, cgRuntime.getAbsolutePath(), + String[] openJmlConfig = new String[] { JavaToolsUtils.JAVA, JavaToolsUtils.JAR_ARG, openJml.getAbsolutePath(), + IOpenJmlConsts.CP_ARG, + "\"" + cgRuntime.getAbsolutePath() + File.pathSeparator + vdm2jmlRuntime.getAbsolutePath() + "\"", IOpenJmlConsts.RAC_ARG, - /*IOpenJmlConsts.RAC_TO_ASSERT_ARG,*/ + /* IOpenJmlConsts.RAC_TO_ASSERT_ARG, */ IOpenJmlConsts.NO_PURITY_CHECKS_ARG }; String[] javaFiles = JavaCodeGenUtil.findJavaFilePathsRec(genJavaFolder); @@ -233,7 +233,8 @@ protected String[] getExecArgs() String runtimes = jmlRuntime.getAbsolutePath() + File.pathSeparatorChar + openJml.getAbsolutePath() + File.pathSeparatorChar + genJavaFolder.getAbsolutePath() + File.pathSeparatorChar - + cgRuntime.getAbsolutePath(); + + cgRuntime.getAbsolutePath() + File.pathSeparatorChar + + vdm2jmlRuntime.getAbsolutePath(); String[] args = new String[] { JavaToolsUtils.JAVA, JavaToolsUtils.CP_ARG, runtimes, From 8251f8b6dd4709e6d8e8fc42df40f6378104478b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 16:30:01 +0200 Subject: [PATCH 221/706] Make all user and quote classes import the VDM to Java runtime --- .../overture/codegen/vdm2jml/JmlGenerator.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java index b8f7f57432..0a9accd427 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java @@ -55,6 +55,7 @@ public class JmlGenerator implements IREventObserver, IJavaQuoteEventObserver { + private static final String VDM_JML_RUNTIME_IMPORT = "org.overture.codegen.vdm2jml.runtime.*"; public static final String DEFAULT_JAVA_ROOT_PACKAGE = "project"; public static final String GEN_INV_METHOD_PARAM_NAME = "elem"; public static final String INV_PREFIX = "inv_"; @@ -245,9 +246,14 @@ public List> finalIRConstructed(List> ast, // Also extract classes that are records for(IRStatus status : IRStatus.extract(newAst, ADefaultClassDeclCG.class)) { + ADefaultClassDeclCG clazz = status.getIrNode(); + // VDM uses the type system to control whether 'nil' is allowed as a value so we'll // just annotate all classes as @nullable_by_default - annotator.makeNullableByDefault(status.getIrNode()); + annotator.makeNullableByDefault(clazz); + + // Make sure that the classes can access the VDM to JML runtime + addVdmToJmlRuntimeImport(clazz); } // Only extract from 'ast' to not get the record classes @@ -326,6 +332,15 @@ public List> finalIRConstructed(List> ast, return newAst; } + private void addVdmToJmlRuntimeImport(ADefaultClassDeclCG clazz) + { + String vdmJmlRuntimeImport = VDM_JML_RUNTIME_IMPORT; + List allImports = new LinkedList<>(); + allImports.addAll(clazz.getDependencies()); + allImports.add(new ClonableString(vdmJmlRuntimeImport)); + clazz.setDependencies(allImports); + } + private RecClassInfo makeRecStateAccessorBased(List> ast) { RecAccessorTrans recAccTr = new RecAccessorTrans(this); @@ -661,6 +676,7 @@ public void quoteClassesProduced(List quoteClasses) // field is null. So we'll mark quote classes as nullable_by_default. //Example from class represented : private static AQuote instance = null; annotator.makeNullableByDefault(qc); + addVdmToJmlRuntimeImport(qc); } } } From 46e8896e21f27b0714f060ac9b3666083b3c9da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 19:35:57 +0200 Subject: [PATCH 222/706] Remove duplicate result files --- .../src/test/resources/micro/pos/FuncPostCondition.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/FunctionApply.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/MapApply.vdmsl.RESULT | 1 - .../src/test/resources/micro/pos/MapSeqofCompatible.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/NonEmptySeq.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/NonZero.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/OpCall_Pre.vdmsl.RESULT | 1 - .../micro/pos/OpPostCondition_CallAsgnCall.vdmsl.RESULT | 1 - .../resources/micro/pos/OpPostCondition_CallCall.vdmsl.RESULT | 1 - .../micro/pos/OpPostCondition_CallCallAsgn.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/OpSat.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/OpSat_FrameRd.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/OpSat_FrameWr.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/OpSat_Inv.vdmsl.RESULT | 1 - .../src/test/resources/micro/pos/OpSat_PostOldVal.vdmsl.RESULT | 1 - .../test/resources/micro/pos/OpSat_PreStateResult.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/OpSat_Result.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/OpSat_State.vdmsl.RESULT | 1 - .../src/test/resources/micro/pos/OpSat_State_Result.vdmsl.RESULT | 1 - .../test/resources/micro/pos/Satisfiability_ImpFunc.vdmsl.RESULT | 1 - .../resources/micro/pos/Satisfiability_ImpOp_Class.vdmpp.RESULT | 1 - core/pog/src/test/resources/micro/pos/StateInv_Asgn.vdmsl.RESULT | 1 - .../test/resources/micro/pos/StateInv_AtomicAsgn.vdmsl.RESULT | 1 - core/pog/src/test/resources/micro/pos/Subtype_Inv.vdmsl.RESULT | 1 - .../pog/src/test/resources/micro/pos/TupleSelection.vdmsl.RESULT | 1 - 25 files changed, 25 deletions(-) delete mode 100644 core/pog/src/test/resources/micro/pos/FuncPostCondition.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/FunctionApply.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/MapApply.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/MapSeqofCompatible.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/NonEmptySeq.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/NonZero.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpCall_Pre.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpPostCondition_CallAsgnCall.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpPostCondition_CallCall.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpPostCondition_CallCallAsgn.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat_FrameRd.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat_FrameWr.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat_Inv.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat_PostOldVal.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat_PreStateResult.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat_Result.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat_State.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/OpSat_State_Result.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/Satisfiability_ImpFunc.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/Satisfiability_ImpOp_Class.vdmpp.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/StateInv_Asgn.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/StateInv_AtomicAsgn.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/Subtype_Inv.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/pos/TupleSelection.vdmsl.RESULT diff --git a/core/pog/src/test/resources/micro/pos/FuncPostCondition.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/FuncPostCondition.vdmsl.RESULT deleted file mode 100644 index 900c48bb73..0000000000 --- a/core/pog/src/test/resources/micro/pos/FuncPostCondition.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"function establishes postcondition","poExp":"(forall n:nat \u0026 (pre_ExplFn(n) \u003d\u003e post_ExplFn(n, (n ** 6))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/FunctionApply.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/FunctionApply.vdmsl.RESULT deleted file mode 100644 index 8403c4873c..0000000000 --- a/core/pog/src/test/resources/micro/pos/FunctionApply.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"legal function application","poExp":"(forall n:int \u0026 ((n \u003e\u003d 0) \u003d\u003e ((not (n \u003d 0)) \u003d\u003e pre_Fun((n - 1)))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/MapApply.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/MapApply.vdmsl.RESULT deleted file mode 100644 index 328ada232b..0000000000 --- a/core/pog/src/test/resources/micro/pos/MapApply.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"legal map application","poExp":"(forall n:nat \u0026 ((n in set (dom M)) \u003d\u003e (n in set (dom M))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/MapSeqofCompatible.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/MapSeqofCompatible.vdmsl.RESULT deleted file mode 100644 index 28dad378e9..0000000000 --- a/core/pog/src/test/resources/micro/pos/MapSeqofCompatible.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"enumeration map injectivity","poExp":"(forall m1, m2 in set {{2 |-\u003e true}, {3 |-\u003e false}} \u0026 (forall d3 in set (dom m1), d4 in set (dom m2) \u0026 ((d3 \u003d d4) \u003d\u003e (m1(d3) \u003d m2(d4)))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/NonEmptySeq.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/NonEmptySeq.vdmsl.RESULT deleted file mode 100644 index 6b8589d7d0..0000000000 --- a/core/pog/src/test/resources/micro/pos/NonEmptySeq.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"non-empty sequence","poExp":"(forall list:seq of (nat) \u0026 ((not (list \u003d [])) \u003d\u003e (list \u003c\u003e [])))"},{"poKind":"non-empty sequence","poExp":"(forall list:seq of (nat) \u0026 ((not (list \u003d [])) \u003d\u003e (list \u003c\u003e [])))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/NonZero.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/NonZero.vdmsl.RESULT deleted file mode 100644 index f2c88c939a..0000000000 --- a/core/pog/src/test/resources/micro/pos/NonZero.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"non-zero","poExp":"(true \u003d\u003e (0 \u003c\u003e 0))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpCall_Pre.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpCall_Pre.vdmsl.RESULT deleted file mode 100644 index 05c20a6117..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpCall_Pre.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation call","poExp":"((x \u003d 0) \u003d\u003e (x \u003d 0))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpPostCondition_CallAsgnCall.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpPostCondition_CallAsgnCall.vdmsl.RESULT deleted file mode 100644 index 483176cea8..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpPostCondition_CallAsgnCall.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation establishes postcondition","poExp":"((x \u003d 0) \u003d\u003e ((x + 1) \u003d (x + 1)))"},{"poKind":"operation establishes postcondition","poExp":"((x \u003c\u003e 0) \u003d\u003e ((x + 2) \u003d (x + 2)))"},{"poKind":"operation call","poExp":"((x \u003d 0) \u003d\u003e (x \u003d 0))"},{"poKind":"operation call","poExp":"((x \u003d 0) \u003d\u003e (forall x1:int \u0026 ((x1 \u003d (x + 1)) \u003d\u003e (3 \u003c\u003e 0))))"},{"poKind":"operation establishes postcondition","poExp":"((x \u003d 0) \u003d\u003e (forall x1:int \u0026 ((x1 \u003d (x + 1)) \u003d\u003e (forall x2:int \u0026 ((x2 \u003d (x1 + 2)) \u003d\u003e (x2 \u003d x))))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpPostCondition_CallCall.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpPostCondition_CallCall.vdmsl.RESULT deleted file mode 100644 index b5b4b6b5c9..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpPostCondition_CallCall.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation establishes postcondition","poExp":"((x \u003d 0) \u003d\u003e ((x + 1) \u003d (x + 1)))"},{"poKind":"operation establishes postcondition","poExp":"((x \u003c\u003e 0) \u003d\u003e ((x + 2) \u003d (x + 2)))"},{"poKind":"operation call","poExp":"((x \u003d 0) \u003d\u003e (x \u003d 0))"},{"poKind":"operation call","poExp":"((x \u003d 0) \u003d\u003e (forall x1:int \u0026 ((x1 \u003d (x + 1)) \u003d\u003e (x1 \u003c\u003e 0))))"},{"poKind":"operation establishes postcondition","poExp":"((x \u003d 0) \u003d\u003e (forall x1:int \u0026 ((x1 \u003d (x + 1)) \u003d\u003e (forall x2:int \u0026 ((x2 \u003d (x1 + 2)) \u003d\u003e (x2 \u003d x))))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpPostCondition_CallCallAsgn.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpPostCondition_CallCallAsgn.vdmsl.RESULT deleted file mode 100644 index 47a3a7cc49..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpPostCondition_CallCallAsgn.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation establishes postcondition","poExp":"((x \u003d 0) \u003d\u003e ((x + 1) \u003d (x + 1)))"},{"poKind":"operation establishes postcondition","poExp":"((x \u003c\u003e 0) \u003d\u003e ((x + 2) \u003d (x + 2)))"},{"poKind":"operation call","poExp":"((x \u003d 0) \u003d\u003e (x \u003d 0))"},{"poKind":"operation call","poExp":"((x \u003d 0) \u003d\u003e (forall x1:int \u0026 ((x1 \u003d (x + 1)) \u003d\u003e (x1 \u003c\u003e 0))))"},{"poKind":"operation establishes postcondition","poExp":"((x \u003d 0) \u003d\u003e (forall x1:int \u0026 ((x1 \u003d (x + 1)) \u003d\u003e (forall x2:int \u0026 ((x2 \u003d (x1 + 2)) \u003d\u003e (3 \u003d x))))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat.vdmsl.RESULT deleted file mode 100644 index 56366845be..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"true"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat_FrameRd.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat_FrameRd.vdmsl.RESULT deleted file mode 100644 index 3be9f79cf1..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat_FrameRd.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"(exists y1:int \u0026 (true and (y \u003d y1)))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat_FrameWr.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat_FrameWr.vdmsl.RESULT deleted file mode 100644 index b8e3aedbec..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat_FrameWr.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"(exists y1:int \u0026 true)"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat_Inv.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat_Inv.vdmsl.RESULT deleted file mode 100644 index da8cd47d7f..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat_Inv.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"state invariant initialized","poExp":"(x \u003d y)"},{"poKind":"state invariant satisfiable","poExp":"(exists x:int, y:int \u0026 (x \u003d y))"},{"poKind":"operation satisfiability","poExp":"((x \u003d y) \u003d\u003e (exists x1:int, y2:int \u0026 true))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat_PostOldVal.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat_PostOldVal.vdmsl.RESULT deleted file mode 100644 index 3da4c0a506..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat_PostOldVal.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"(exists x1:int \u0026 (x1 \u003d (x~ + 1)))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat_PreStateResult.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat_PreStateResult.vdmsl.RESULT deleted file mode 100644 index 7ade41fbb6..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat_PreStateResult.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"((y \u003e 0) \u003d\u003e (exists y1:int, x2:nat, n:nat \u0026 (y1 \u003d n)))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat_Result.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat_Result.vdmsl.RESULT deleted file mode 100644 index 4bae7fd2c7..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat_Result.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"(exists r:int \u0026 (r \u003d 0))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat_State.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat_State.vdmsl.RESULT deleted file mode 100644 index 8336a3a372..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat_State.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"(exists n1:nat \u0026 (n1 \u003d 0))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/OpSat_State_Result.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/OpSat_State_Result.vdmsl.RESULT deleted file mode 100644 index b4dabd1fc5..0000000000 --- a/core/pog/src/test/resources/micro/pos/OpSat_State_Result.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"(exists n1:nat, r:nat \u0026 (n1 \u003d r))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/Satisfiability_ImpFunc.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/Satisfiability_ImpFunc.vdmsl.RESULT deleted file mode 100644 index 92e25e5fea..0000000000 --- a/core/pog/src/test/resources/micro/pos/Satisfiability_ImpFunc.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"function postcondition satisfiable","poExp":"(forall mk_(a, b):(nat * nat), c:nat \u0026 (pre_f(mk_(a, b), c) \u003d\u003e (exists d:bool \u0026 post_f(mk_(a, b), c, d))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/Satisfiability_ImpOp_Class.vdmpp.RESULT b/core/pog/src/test/resources/micro/pos/Satisfiability_ImpOp_Class.vdmpp.RESULT deleted file mode 100644 index 0637a088a0..0000000000 --- a/core/pog/src/test/resources/micro/pos/Satisfiability_ImpOp_Class.vdmpp.RESULT +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/StateInv_Asgn.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/StateInv_Asgn.vdmsl.RESULT deleted file mode 100644 index a82ed9caf3..0000000000 --- a/core/pog/src/test/resources/micro/pos/StateInv_Asgn.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"state invariant initialized","poExp":"(0 \u003d 0)"},{"poKind":"state invariant satisfiable","poExp":"(exists n:nat, m:nat \u0026 (n \u003d m))"},{"poKind":"state invariant holds","poExp":"(forall a:nat \u0026 ((n \u003d m) \u003d\u003e (1 \u003d m)))"},{"poKind":"state invariant holds","poExp":"(forall a:nat \u0026 ((1 \u003d m) \u003d\u003e (1 \u003d 2)))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/StateInv_AtomicAsgn.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/StateInv_AtomicAsgn.vdmsl.RESULT deleted file mode 100644 index 57cdbf41f9..0000000000 --- a/core/pog/src/test/resources/micro/pos/StateInv_AtomicAsgn.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"state invariant initialized","poExp":"(x \u003d y)"},{"poKind":"state invariant satisfiable","poExp":"(exists x:int, y:int \u0026 (x \u003d y))"},{"poKind":"state invariant holds","poExp":"((x \u003d y) \u003d\u003e (1 \u003d 1))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/Subtype_Inv.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/Subtype_Inv.vdmsl.RESULT deleted file mode 100644 index 5ce7f8db62..0000000000 --- a/core/pog/src/test/resources/micro/pos/Subtype_Inv.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"type invariant satisfiable","poExp":"(exists e:Even \u0026 ((e mod 2) \u003d 0))"},{"poKind":"type compatibility","poExp":"(forall n:int \u0026 (inv_Even(n) and is_(n, int)))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/pos/TupleSelection.vdmsl.RESULT b/core/pog/src/test/resources/micro/pos/TupleSelection.vdmsl.RESULT deleted file mode 100644 index 8359c0f1f8..0000000000 --- a/core/pog/src/test/resources/micro/pos/TupleSelection.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"tuple selection","poExp":"(forall x:A \u0026 (not is_(x, int)))"}] \ No newline at end of file From 595459869647aabcb36f19a4b97af7fd7772b6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 19 Oct 2015 19:42:32 +0200 Subject: [PATCH 223/706] Removing more duplicate result files --- .../resources/micro/ctxts/ExpOpCtxt_NoStateParams.vdmsl.RESULT | 1 - .../resources/micro/ctxts/ExpOpCtxt_StateNoParams.vdmsl.RESULT | 1 - .../resources/micro/ctxts/ExpOpCtxt_StateParams.vdmsl.RESULT | 1 - .../micro/ctxts/ImpOpCtxt_StateResultFrame.vdmsl.RESULT | 1 - .../micro/ctxts/ImpOpCtxt_StateResultNoFrame.vdmsl.RESULT | 1 - 5 files changed, 5 deletions(-) delete mode 100644 core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_NoStateParams.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_StateNoParams.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_StateParams.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/ctxts/ImpOpCtxt_StateResultFrame.vdmsl.RESULT delete mode 100644 core/pog/src/test/resources/micro/ctxts/ImpOpCtxt_StateResultNoFrame.vdmsl.RESULT diff --git a/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_NoStateParams.vdmsl.RESULT b/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_NoStateParams.vdmsl.RESULT deleted file mode 100644 index 4cec66bd6c..0000000000 --- a/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_NoStateParams.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"non-zero","poExp":"(forall x:int \u0026 (x \u003c\u003e 0))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_StateNoParams.vdmsl.RESULT b/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_StateNoParams.vdmsl.RESULT deleted file mode 100644 index d8df2b1e25..0000000000 --- a/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_StateNoParams.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"non-zero","poExp":"(y \u003c\u003e 0)"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_StateParams.vdmsl.RESULT b/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_StateParams.vdmsl.RESULT deleted file mode 100644 index 4cec66bd6c..0000000000 --- a/core/pog/src/test/resources/micro/ctxts/ExpOpCtxt_StateParams.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"non-zero","poExp":"(forall x:int \u0026 (x \u003c\u003e 0))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/ctxts/ImpOpCtxt_StateResultFrame.vdmsl.RESULT b/core/pog/src/test/resources/micro/ctxts/ImpOpCtxt_StateResultFrame.vdmsl.RESULT deleted file mode 100644 index 099bdf95c4..0000000000 --- a/core/pog/src/test/resources/micro/ctxts/ImpOpCtxt_StateResultFrame.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"(forall ns:set of (nat) \u0026 (exists y1:int, n:nat \u0026 (true and (y \u003d y1))))"}] \ No newline at end of file diff --git a/core/pog/src/test/resources/micro/ctxts/ImpOpCtxt_StateResultNoFrame.vdmsl.RESULT b/core/pog/src/test/resources/micro/ctxts/ImpOpCtxt_StateResultNoFrame.vdmsl.RESULT deleted file mode 100644 index 869569a118..0000000000 --- a/core/pog/src/test/resources/micro/ctxts/ImpOpCtxt_StateResultNoFrame.vdmsl.RESULT +++ /dev/null @@ -1 +0,0 @@ -[{"poKind":"operation satisfiability","poExp":"(forall ns:set of (nat) \u0026 (exists y1:int, x2:nat, n:nat \u0026 (n in set ns)))"}] \ No newline at end of file From eb3555bea51c69c9219bc0062a46e51780fd89b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 20 Oct 2015 21:02:22 +0200 Subject: [PATCH 224/706] Cleaning up JML generator runtime --- .../overture/codegen/vdm2jml/runtime/V2J.java | 196 ++++++++++-------- 1 file changed, 109 insertions(+), 87 deletions(-) diff --git a/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java b/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java index f4520124b2..91785f479a 100644 --- a/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java +++ b/core/codegen/vdm2jml-runtime/src/main/java/org/overture/codegen/vdm2jml/runtime/V2J.java @@ -9,166 +9,188 @@ import org.overture.codegen.runtime.VDMSeq; import org.overture.codegen.runtime.VDMSet; +/** + * Runtime library used by the Java Modeling Language (JML) generator, which translates VDM-SL models into JML annotated + * Java. The JML annotations generated by the VDM-SL to Java/JML generator uses the methods in this class. + * + * @author pvj + */ public class V2J { - public static boolean isInjMap(Object obj) + /*@ pure @*/ + /*@ helper @*/ + public static boolean isMap(Object subject) { - if(isMap(obj)) + return subject instanceof VDMMap; + } + + /* @ pure @ */ + /* @ helper @ */ + public static boolean isInjMap(Object subject) + { + if (subject instanceof VDMMap) { - VDMMap map = (VDMMap) obj; + VDMMap map = (VDMMap) subject; @SuppressWarnings("unchecked") HashSet values = new HashSet<>(map.values()); + return map.keySet().size() == values.size(); - } - else + } else { return false; } } - public static boolean isMap(Object obj) + /*@ pure @*/ + /*@ helper @*/ + public static boolean isSet(Object subject) { - return obj instanceof VDMMap; + return subject instanceof VDMSet; } - public static boolean isSet(Object obj) + /*@ pure @*/ + /*@ helper @*/ + public static boolean isSeq(Object subject) { - return obj instanceof VDMSet; + return subject instanceof VDMSeq; } - public static boolean isSeq(Object obj) + /*@ pure @*/ + /*@ helper @*/ + public static boolean isSeq1(Object subject) { - return obj instanceof VDMSeq; + if (subject instanceof VDMSeq) + { + VDMSeq seq = (VDMSeq) subject; + return !seq.isEmpty(); + } else + { + return false; + } } - public static boolean isSeq1(Object obj) + /*@ pure @*/ + /*@ helper @*/ + public static boolean isTup(Object subject, int size) { - if(obj instanceof VDMSeq) + if (subject instanceof Tuple) { - VDMSeq seq = (VDMSeq) obj; - return !seq.isEmpty(); - } - else + Tuple t = (Tuple) subject; + + return t.size() == size; + } else { return false; } } - /*@ pure @*/ - public static VDMSeq toSeq(Object o) + /*@ pure @*/ + /*@ helper @*/ + public static Object field(Object subject, int fieldNo) { - if(o instanceof VDMSeq) + if (subject instanceof Tuple) + { + Tuple tuple = (Tuple) subject; + + return tuple.get(fieldNo); + } else { - return (VDMSeq) o; + throw new IllegalArgumentException("Method is only supported for " + Tuple.class); } - - throw new IllegalArgumentException("Method is only supported for " + VDMSeq.class); } - /*@ pure @*/ - public static Object get(Object col, int i) + /*@ pure @*/ + /*@ helper @*/ + public static Object get(Object col, int index) { - if(col instanceof VDMSeq) + if (col instanceof VDMSeq) { - return ((VDMSeq) col).get(i); - } - else if(col instanceof VDMSet) + VDMSeq seq = (VDMSeq) col; + + return seq.get(index); + } else if (col instanceof VDMSet) { VDMSeq seq = set2seq(col); - return seq.get(i); + + return seq.get(index); } - + throw new IllegalArgumentException("Method is only supported for " + VDMSeq.class + " and " + VDMSet.class); } + /*@ pure @*/ + /*@ helper @*/ @SuppressWarnings("unchecked") - public static Object getDom(Object map, int i) + public static Object getDom(Object subject, int index) { - if(map instanceof VDMMap) + if (subject instanceof VDMMap) { - VDMMap cMap = (VDMMap) map; - //http://stackoverflow.com/questions/2923856/is-the-order-guaranteed-for-the-return-of-keys-and-values-from-a-linkedhashmap-o - + VDMMap map = (VDMMap) subject; + // http://stackoverflow.com/questions/2923856/is-the-order-guaranteed-for-the-return-of-keys-and-values-from-a-linkedhashmap-o + VDMSeq seq = SeqUtil.seq(); - seq.addAll(cMap.keySet()); - return seq.get(i); + seq.addAll(map.keySet()); + + return seq.get(index); } - + throw new IllegalArgumentException("Method is only supported for " + VDMMap.class); } + /*@ pure @*/ + /*@ helper @*/ @SuppressWarnings("unchecked") - public static Object getRng(Object map, int i) + public static Object getRng(Object subject, int index) { - if(map instanceof VDMMap) + if (subject instanceof VDMMap) { - VDMMap cMap = (VDMMap) map; - + VDMMap map = (VDMMap) subject; + VDMSeq seq = SeqUtil.seq(); - seq.addAll(cMap.values()); - return seq.get(i); + seq.addAll(map.values()); + + return seq.get(index); } - + throw new IllegalArgumentException("Method is only supported for " + VDMMap.class); } - /*@ pure @*/ - public static int size(Object o) + /*@ pure @*/ + /*@ helper @*/ + public static int size(Object vdmCol) { // Covers sequences and sets - if(o instanceof Collection) + if (vdmCol instanceof Collection) { - return ((Collection) o).size(); + Collection setSeq = (Collection) vdmCol; + + return setSeq.size(); } - + // Covers maps - if(o instanceof VDMMap) + if (vdmCol instanceof VDMMap) { - return ((VDMMap) o).size(); + VDMMap map = (VDMMap) vdmCol; + + return map.size(); } - - throw new IllegalArgumentException("Method is only supported for " + Collection.class); + + throw new IllegalArgumentException("Method is only supported for " + Collection.class + " and " + VDMMap.class); } - + + /*@ pure @*/ + /*@ helper @*/ @SuppressWarnings("unchecked") - /*@ pure @*/ public static VDMSeq set2seq(Object set) { - if(set instanceof VDMSet) + if (set instanceof VDMSet) { VDMSeq seq = SeqUtil.seq(); seq.addAll((VDMSet) set); + return seq; } - + throw new IllegalArgumentException("Method is only supported for " + VDMSet.class); } - - /*@ pure @*/ - public static boolean isTup(Object subject, int size) - { - if(subject instanceof Tuple) - { - Tuple t = (Tuple) subject; - - return t.size() == size; - } - else - { - return false; - } - } - - /*@ pure @*/ - public static Object field(Object tup, int fieldNumber) - { - if(tup instanceof Tuple) - { - return ((Tuple) tup).get(fieldNumber); - } - else - { - throw new IllegalArgumentException("Method is only supported for " + Tuple.class); - } - } } From f8eeac179439167c7861c0738712600fb3938925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 20 Oct 2015 22:36:00 +0200 Subject: [PATCH 225/706] Also generate VDM-to-JML runtime with sources attached --- core/codegen/vdm2jml-runtime/pom.xml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml-runtime/pom.xml b/core/codegen/vdm2jml-runtime/pom.xml index c8358d4e45..72a1d86149 100644 --- a/core/codegen/vdm2jml-runtime/pom.xml +++ b/core/codegen/vdm2jml-runtime/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 @@ -40,6 +41,18 @@ + + maven-source-plugin + + + attach-sources + + jar-no-fork + + + + + From 1af1433689017b5b448f140bcf834e4c4d243e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 20 Oct 2015 22:37:08 +0200 Subject: [PATCH 226/706] Make VDM-to-JML binaries available to the codegen plugin --- ide/plugins/codegen/pom.xml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ide/plugins/codegen/pom.xml b/ide/plugins/codegen/pom.xml index 7c94da7ece..0372f712f5 100644 --- a/ide/plugins/codegen/pom.xml +++ b/ide/plugins/codegen/pom.xml @@ -39,6 +39,11 @@ codegen-runtime ${project.version} + + org.overturetool.core.codegen + vdm2jml-runtime + ${project.version} + org.overturetool.core.codegen ir @@ -114,6 +119,25 @@ ${basedir}/target/runtime codegen-runtime-sources.jar + + org.overturetool.core.codegen + vdm2jml-runtime + ${project.version} + jar + true + ${basedir}/target/runtime + vdm2jml-runtime.jar + + + org.overturetool.core.codegen + vdm2jml-runtime + ${project.version} + sources + jar + true + ${basedir}/target/runtime + vdm2jml-runtime-sources.jar + From 846451b010c64834cf27a285212cdbab93ca1ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 20 Oct 2015 22:39:03 +0200 Subject: [PATCH 227/706] Bundle codegen-runtime and vdm2jml-runtime with the codegen plugin --- ide/plugins/codegen/META-INF/MANIFEST.MF | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ide/plugins/codegen/META-INF/MANIFEST.MF b/ide/plugins/codegen/META-INF/MANIFEST.MF index 8f3e14dca3..4afd40e8ad 100644 --- a/ide/plugins/codegen/META-INF/MANIFEST.MF +++ b/ide/plugins/codegen/META-INF/MANIFEST.MF @@ -26,6 +26,8 @@ Bundle-ClassPath: ., jars/platform.jar, jars/javagen.jar, jars/vdm2jml.jar, + jars/codegen-runtime.jar, + jars/vdm2jml-runtime.jar, jars/commons-collections.jar, jars/commons-lang.jar, jars/jalopy.jar, From fc1843d853ce34e617dc313025e079c36b7b1780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Tue, 20 Oct 2015 22:44:42 +0200 Subject: [PATCH 228/706] Include the VDM-to-JML runtime in the generated Eclipse project when the VDM-to-JML feature is used --- ide/plugins/codegen/eclipsefiles/cg.classpath | 2 +- .../codegen/commands/Vdm2JavaCommand.java | 63 +++++++++++++++++-- .../codegen/util/PluginVdm2JavaUtil.java | 10 ++- 3 files changed, 68 insertions(+), 7 deletions(-) diff --git a/ide/plugins/codegen/eclipsefiles/cg.classpath b/ide/plugins/codegen/eclipsefiles/cg.classpath index ea32e05f55..494e090e06 100644 --- a/ide/plugins/codegen/eclipsefiles/cg.classpath +++ b/ide/plugins/codegen/eclipsefiles/cg.classpath @@ -2,6 +2,6 @@ - + %s diff --git a/ide/plugins/codegen/src/main/java/org/overture/ide/plugins/codegen/commands/Vdm2JavaCommand.java b/ide/plugins/codegen/src/main/java/org/overture/ide/plugins/codegen/commands/Vdm2JavaCommand.java index 71aaa63c1f..912f0d3cb1 100644 --- a/ide/plugins/codegen/src/main/java/org/overture/ide/plugins/codegen/commands/Vdm2JavaCommand.java +++ b/ide/plugins/codegen/src/main/java/org/overture/ide/plugins/codegen/commands/Vdm2JavaCommand.java @@ -236,14 +236,53 @@ protected IStatus run(IProgressMonitor monitor) CodeGenConsole.GetInstance().printErrorln("Reason: " + e.getMessage()); } + if(generateJml(vdmProject)) + { + try + { + PluginVdm2JavaUtil.copyCodeGenFile(PluginVdm2JavaUtil.VDM2JML_RUNTIME_BIN_FILE, libFolder); + outputVdm2JmlBinaries(libFolder); + } + catch(Exception e) + { + CodeGenConsole.GetInstance().printErrorln("Problems copying the VDM-to-JML runtime library to " + libFolder.getAbsolutePath()); + CodeGenConsole.GetInstance().printErrorln("Reason: " + e.getMessage()); + } + + try + { + PluginVdm2JavaUtil.copyCodeGenFile(PluginVdm2JavaUtil.VDM2JML_RUNTIME_SOURCES_FILE, libFolder); + outputVdm2JmlSources(libFolder); + } + catch(Exception e) + { + CodeGenConsole.GetInstance().printErrorln("Problems copying the VDM-to-JML runtime library sources to " + libFolder.getAbsolutePath()); + CodeGenConsole.GetInstance().printErrorln("Reason: " + e.getMessage()); + } + } + try { PluginVdm2JavaUtil.copyCodeGenFile(PluginVdm2JavaUtil.ECLIPSE_RES_FILES_FOLDER + "/" + PluginVdm2JavaUtil.ECLIPSE_PROJECT_TEMPLATE_FILE, PluginVdm2JavaUtil.ECLIPSE_PROJECT_FILE, eclipseProjectFolder); + + GeneralCodeGenUtils.replaceInFile(new File(eclipseProjectFolder, PluginVdm2JavaUtil.ECLIPSE_PROJECT_FILE), "%s", project.getName()); + + PluginVdm2JavaUtil.copyCodeGenFile(PluginVdm2JavaUtil.ECLIPSE_RES_FILES_FOLDER + "/" + PluginVdm2JavaUtil.ECLIPSE_CLASSPATH_TEMPLATE_FILE, PluginVdm2JavaUtil.ECLIPSE_CLASSPATH_FILE, eclipseProjectFolder); - GeneralCodeGenUtils.replaceInFile(new File(eclipseProjectFolder, PluginVdm2JavaUtil.ECLIPSE_PROJECT_FILE), "%s", project.getName()); + // Always imports codegen-runtime.jar + String classPathEntries = PluginVdm2JavaUtil.RUNTIME_CLASSPATH_ENTRY; + + if(generateJml(vdmProject)) + { + // Import the VDM-to-JML runtime + classPathEntries += PluginVdm2JavaUtil.VDM2JML_CLASSPATH_ENTRY; + } + + GeneralCodeGenUtils.replaceInFile(new File(eclipseProjectFolder, PluginVdm2JavaUtil.ECLIPSE_CLASSPATH_FILE), "%s", classPathEntries); + CodeGenConsole.GetInstance().println("Generated Eclipse project with Java generated code.\n"); @@ -316,10 +355,7 @@ public GeneratedData generateJava(final IVdmProject project, { List ast = PluginVdm2JavaUtil.getModules(model.getSourceUnits()); - Preferences prefs = getPrefs(); - final boolean generateJml = prefs.getBoolean(ICodeGenConstants.GENERATE_JML, ICodeGenConstants.GENERATE_JML_DEFAULT);; - - if (generateJml) + if (generateJml(project)) { JmlGenerator jmlGen = new JmlGenerator(vdm2java); return jmlGen.generateJml(ast); @@ -329,6 +365,11 @@ public GeneratedData generateJava(final IVdmProject project, } } } + + private boolean generateJml(IVdmProject project) + { + return project.getDialect() == Dialect.VDM_SL && getPrefs().getBoolean(ICodeGenConstants.GENERATE_JML, ICodeGenConstants.GENERATE_JML_DEFAULT); + } public IRSettings getIrSettings(final IProject project) { @@ -456,6 +497,18 @@ private void outputRuntimeSources(File outputFolder) File runtime = new File(outputFolder, PluginVdm2JavaUtil.CODEGEN_RUNTIME_SOURCES_FILE); CodeGenConsole.GetInstance().println("Copied the Java code generator runtime library sources to " + runtime.getAbsolutePath() + "\n"); } + + private void outputVdm2JmlBinaries(File outputFolder) + { + File vdm2jmlRuntime = new File(outputFolder, PluginVdm2JavaUtil.VDM2JML_RUNTIME_BIN_FILE); + CodeGenConsole.GetInstance().println("Copied the VDM-to-JML runtime library to " + vdm2jmlRuntime.getAbsolutePath()); + } + + private void outputVdm2JmlSources(File outputFolder) + { + File vdm2jmlSources = new File(outputFolder, PluginVdm2JavaUtil.VDM2JML_RUNTIME_BIN_FILE); + CodeGenConsole.GetInstance().println("Copied the VDM-to-JML runtime library sources to " + vdm2jmlSources.getAbsolutePath() + "\n"); + } private void outputUserspecifiedModules(File outputFolder, List userspecifiedClasses) diff --git a/ide/plugins/codegen/src/main/java/org/overture/ide/plugins/codegen/util/PluginVdm2JavaUtil.java b/ide/plugins/codegen/src/main/java/org/overture/ide/plugins/codegen/util/PluginVdm2JavaUtil.java index 6ac4b5820b..9bef72b72e 100644 --- a/ide/plugins/codegen/src/main/java/org/overture/ide/plugins/codegen/util/PluginVdm2JavaUtil.java +++ b/ide/plugins/codegen/src/main/java/org/overture/ide/plugins/codegen/util/PluginVdm2JavaUtil.java @@ -71,9 +71,13 @@ public class PluginVdm2JavaUtil { + public static final String CODEGEN_RUNTIME_LIB_FOLDER = "lib"; + public static final String CODEGEN_RUNTIME_BIN_FILE = "codegen-runtime.jar"; public static final String CODEGEN_RUNTIME_SOURCES_FILE = "codegen-runtime-sources.jar"; - public static final String CODEGEN_RUNTIME_LIB_FOLDER = "lib"; + + public static final String VDM2JML_RUNTIME_BIN_FILE = "vdm2jml-runtime.jar"; + public static final String VDM2JML_RUNTIME_SOURCES_FILE = "vdm2jml-runtime-sources.jar"; public static final String ECLIPSE_CLASSPATH_TEMPLATE_FILE = "cg.classpath"; public static final String ECLIPSE_PROJECT_TEMPLATE_FILE = "cg.project"; @@ -83,6 +87,10 @@ public class PluginVdm2JavaUtil public static final String ECLIPSE_PROJECT_FILE = ".project"; public static final String ECLIPSE_RES_FILES_FOLDER = "eclipsefiles"; public static final String ECLIPSE_PROJECT_SRC_FOLDER = "src"; + + public static final String RUNTIME_CLASSPATH_ENTRY = "\n"; + public static final String VDM2JML_CLASSPATH_ENTRY = "\n"; + public static final String WARNING = "[WARNING]"; From bf34a57f5c6387efaff23a37b5e34b6218a19b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 09:07:14 +0200 Subject: [PATCH 229/706] Fix: use 'undefined' as initialiser in ternary-if transformation --- .../src/main/java/org/overture/codegen/trans/Exp2StmTrans.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java index 77f97e2e26..3c75280699 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java @@ -120,7 +120,7 @@ public void caseATernaryIfExpCG(ATernaryIfExpCG node) String resultVarName = transAssistant.getInfo().getTempVarNameGen().nextVarName(prefixes.ternaryIfExp()); - AVarDeclCG resultDecl = transAssistant.consDecl(resultVarName, node.getType().clone(), transAssistant.getInfo().getExpAssistant().consNullExp()); + AVarDeclCG resultDecl = transAssistant.consDecl(resultVarName, node.getType().clone(), transAssistant.getInfo().getExpAssistant().consUndefinedExp()); AIdentifierVarExpCG resultVar = transAssistant.getInfo().getExpAssistant().consIdVar(resultVarName, resultDecl.getType().clone()); SExpCG condition = node.getCondition(); From 05249216e2ffc224f9d6c5b13971c4a4cc7ab167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 14:51:52 +0200 Subject: [PATCH 230/706] Test JML generation of ternary-if --- .../selector/TernaryIf/Entry.java | 79 +++++++++++++++++++ .../selector/TernaryIf/Rec.java | 73 +++++++++++++++++ .../selector/TernaryIf/TernaryIf.vdmsl | 35 ++++++++ .../selector/TernaryIf/TernaryIf.vdmsl.result | 1 + 4 files changed, 188 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/Rec.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/TernaryIf.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/TernaryIf.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/Entry.java new file mode 100644 index 0000000000..9eb6885e12 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/Entry.java @@ -0,0 +1,79 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(); + + //@ assert Utils.is_nat(ignorePattern_1); + + /* skip */ + } + + { + Number ignorePattern_2 = g(); + + //@ assert Utils.is_nat(ignorePattern_2); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number g() { + Number ternaryIfExp_1 = null; + + if (Utils.equals(1L, 1L)) { + ternaryIfExp_1 = 1L; + + //@ assert Utils.is_nat1(ternaryIfExp_1); + } else { + ternaryIfExp_1 = 2L; + + //@ assert Utils.is_nat1(ternaryIfExp_1); + } + + Number x = ternaryIfExp_1; + + //@ assert Utils.is_nat1(x); + Number ret_1 = x; + + //@ assert Utils.is_nat(ret_1); + return ret_1; + } + + /*@ pure @*/ + public static Number f() { + if (Utils.equals(1L, 1L)) { + Number ret_2 = 1L; + + //@ assert Utils.is_nat(ret_2); + return ret_2; + } else { + Number ret_3 = 2L; + + //@ assert Utils.is_nat(ret_3); + return ret_3; + } + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/Rec.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/Rec.java new file mode 100644 index 0000000000..6d6f14b4cf --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/Rec.java @@ -0,0 +1,73 @@ +package project.Entrytypes; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Rec implements Record { + public Number x; + + //@ public instance invariant project.Entry.invChecksOn ==> inv_Rec(x); + public Rec(final Number _x) { + //@ assert Utils.is_int(_x); + x = _x; + + //@ assert Utils.is_int(x); + } + + /*@ pure @*/ + public boolean equals(final Object obj) { + if (!(obj instanceof project.Entrytypes.Rec)) { + return false; + } + + project.Entrytypes.Rec other = ((project.Entrytypes.Rec) obj); + + return Utils.equals(x, other.x); + } + + /*@ pure @*/ + public int hashCode() { + return Utils.hashCode(x); + } + + /*@ pure @*/ + public project.Entrytypes.Rec copy() { + return new project.Entrytypes.Rec(x); + } + + /*@ pure @*/ + public String toString() { + return "mk_Entry`Rec" + Utils.formatFields(x); + } + + /*@ pure @*/ + public Number get_x() { + Number ret_4 = x; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(ret_4)); + return ret_4; + } + + public void set_x(final Number _x) { + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(_x)); + x = _x; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_int(x)); + } + + /*@ pure @*/ + public Boolean valid() { + return true; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Rec(final Number _x) { + return _x.longValue() > 0L; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/TernaryIf.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/TernaryIf.vdmsl new file mode 100644 index 0000000000..03f8f0e50b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/TernaryIf.vdmsl @@ -0,0 +1,35 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +Rec :: x : int +inv r == r.x > 0; + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + let - = g() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +g : () -> nat +g () == +let x = if 1 = 1 then 1 else 2 +in + x; + +f : () -> nat +f () == + if 1 = 1 then 1 else 2; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/TernaryIf.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/TernaryIf.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/TernaryIf/TernaryIf.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file From 2becece3615701b3b5999cfe5091e375937d1c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 15:03:10 +0200 Subject: [PATCH 231/706] Test JML generation of cases expression --- .../overture/codegen/trans/Exp2StmTrans.java | 8 ++- .../selector/CaseExp/CaseExp.vdmsl | 27 +++++++ .../selector/CaseExp/CaseExp.vdmsl.result | 1 + .../selector/CaseExp/Entry.java | 71 +++++++++++++++++++ 4 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/CaseExp.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/CaseExp.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/Entry.java diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java index 3c75280699..9ccb5076e0 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java @@ -56,7 +56,6 @@ import org.overture.codegen.cgast.expressions.ARecordModExpCG; import org.overture.codegen.cgast.expressions.ARecordModifierCG; import org.overture.codegen.cgast.expressions.ATernaryIfExpCG; -import org.overture.codegen.cgast.expressions.AUndefinedExpCG; import org.overture.codegen.cgast.expressions.SBoolBinaryExpCG; import org.overture.codegen.cgast.patterns.AIdentifierPatternCG; import org.overture.codegen.cgast.patterns.ASetMultipleBindCG; @@ -69,6 +68,7 @@ import org.overture.codegen.cgast.types.AIntNumericBasicTypeCG; import org.overture.codegen.cgast.types.SSetTypeCG; import org.overture.codegen.cgast.utils.AHeaderLetBeStCG; +import org.overture.codegen.ir.IRInfo; import org.overture.codegen.ir.ITempVarGen; import org.overture.codegen.trans.assistants.TransAssistantCG; import org.overture.codegen.trans.comp.ComplexCompStrategy; @@ -594,10 +594,12 @@ public void caseACasesExpCG(ACasesExpCG node) throws AnalysisException SStmCG enclosingStm = transAssistant.getEnclosingStm(node, "cases expression"); AIdentifierPatternCG idPattern = new AIdentifierPatternCG(); - String casesExpResultName = transAssistant.getInfo().getTempVarNameGen().nextVarName(prefixes.casesExp()); + IRInfo info = transAssistant.getInfo(); + String casesExpResultName = info.getTempVarNameGen().nextVarName(prefixes.casesExp()); idPattern.setName(casesExpResultName); - AVarDeclCG resultVarDecl = transAssistant.getInfo().getDeclAssistant().consLocalVarDecl(node.getType().clone(), idPattern, new AUndefinedExpCG()); + AVarDeclCG resultVarDecl = info.getDeclAssistant().consLocalVarDecl(node.getType().clone(), + idPattern, info.getExpAssistant().consUndefinedExp()); AIdentifierVarExpCG resultVar = new AIdentifierVarExpCG(); resultVar.setIsLocal(true); diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/CaseExp.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/CaseExp.vdmsl new file mode 100644 index 0000000000..d10ca7b08b --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/CaseExp.vdmsl @@ -0,0 +1,27 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f(2) in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : nat -> nat +f (a) == + cases a: + 1 -> 4, + 2 -> 8, + others -> 2 +end; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/CaseExp.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/CaseExp.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/CaseExp.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/Entry.java new file mode 100644 index 0000000000..1c5eb63e73 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/selector/CaseExp/Entry.java @@ -0,0 +1,71 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(2L); + + //@ assert Utils.is_nat(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number f(final Number a) { + //@ assert Utils.is_nat(a); + Number casesExpResult_1 = null; + + Number intPattern_1 = a; + + //@ assert Utils.is_nat(intPattern_1); + Boolean success_1 = Utils.equals(intPattern_1, 1L); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + Number intPattern_2 = a; + //@ assert Utils.is_nat(intPattern_2); + success_1 = Utils.equals(intPattern_2, 2L); + + //@ assert Utils.is_bool(success_1); + if (success_1) { + casesExpResult_1 = 8L; + + //@ assert Utils.is_nat1(casesExpResult_1); + } else { + casesExpResult_1 = 2L; + + //@ assert Utils.is_nat1(casesExpResult_1); + } + } else { + casesExpResult_1 = 4L; + + //@ assert Utils.is_nat1(casesExpResult_1); + } + + Number ret_1 = casesExpResult_1; + + //@ assert Utils.is_nat(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} From f96da734da9f2f4698522c8b939a891255881f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 15:29:34 +0200 Subject: [PATCH 232/706] Tweaks to the 'cast' expression template No need to cast undefined expressions --- .../java/org/overture/codegen/vdm2java/JavaFormat.java | 5 +++++ .../resources/JavaTemplates/Expressions/Unary/Cast.vm | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java index fed15b9b44..5ed12cef51 100644 --- a/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java +++ b/core/codegen/javagen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java @@ -1004,4 +1004,9 @@ public static String getString(ClonableString c) { return c.value; } + + public boolean isUndefined(ACastUnaryExpCG cast) + { + return info.getExpAssistant().isUndefined(cast); + } } diff --git a/core/codegen/javagen/src/main/resources/JavaTemplates/Expressions/Unary/Cast.vm b/core/codegen/javagen/src/main/resources/JavaTemplates/Expressions/Unary/Cast.vm index af3b3ca0ff..aa9d8ef04b 100644 --- a/core/codegen/javagen/src/main/resources/JavaTemplates/Expressions/Unary/Cast.vm +++ b/core/codegen/javagen/src/main/resources/JavaTemplates/Expressions/Unary/Cast.vm @@ -1,4 +1,8 @@ -#set( $type = $JavaFormat.format($node.getType())) #set( $exp = $JavaFormat.format($node.getExp(), false)) ## -(($type) $exp) \ No newline at end of file +#if ($JavaFormat.isUndefined($node)) + ${exp}## +#else + #set( $type = $JavaFormat.format($node.getType())) + (($type) $exp)## +#end \ No newline at end of file From f7f2dc5538086ebaa407416f357eeb05e2d25a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 15:32:07 +0200 Subject: [PATCH 233/706] Another tweak to IR generation of the let-be-st construct --- .../src/main/java/org/overture/codegen/trans/Exp2StmTrans.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java index 9ccb5076e0..64ecf1c089 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/Exp2StmTrans.java @@ -248,7 +248,7 @@ public void caseALetBeStExpCG(ALetBeStExpCG node) throws AnalysisException if (transAssistant.hasEmptySet(binding)) { transAssistant.cleanUpBinding(binding); - letBeStResult = transAssistant.getInfo().getExpAssistant().consNullExp(); + letBeStResult = transAssistant.getInfo().getExpAssistant().consUndefinedExp(); } else { String var = tempVarNameGen.nextVarName(prefixes.letBeSt()); From b0de3927c2efb9320b830c15d5fabc9c5e8ddc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 15:47:41 +0200 Subject: [PATCH 234/706] Prepare testing of JML generation of simple patterns --- .../tests/exec/JmlSimplePatternExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSimplePatternExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSimplePatternExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSimplePatternExecTests.java new file mode 100644 index 0000000000..bf631c1cf1 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlSimplePatternExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlSimplePatternExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "simple_pattern"; + + public static final String PROPERTY_ID = "simple_pattern"; + + public JmlSimplePatternExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From 8877f6b3ac122849a2cfcb0c1d6fbaf24a4ceb15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 15:48:05 +0200 Subject: [PATCH 235/706] Add tests to exercise JML generation of simple patterns --- .../simple_pattern/Bool/Bool.vdmsl | 25 +++++++ .../simple_pattern/Bool/Bool.vdmsl.result | 1 + .../simple_pattern/Bool/Entry.java | 51 +++++++++++++ .../simple_pattern/Char/Char.vdmsl | 25 +++++++ .../simple_pattern/Char/Char.vdmsl.result | 1 + .../simple_pattern/Char/Entry.java | 73 +++++++++++++++++++ .../simple_pattern/Int/Entry.java | 49 +++++++++++++ .../simple_pattern/Int/Int.vdmsl | 23 ++++++ .../simple_pattern/Int/Int.vdmsl.result | 1 + .../simple_pattern/Nil/Entry.java | 71 ++++++++++++++++++ .../simple_pattern/Nil/Nil.vdmsl | 25 +++++++ .../simple_pattern/Nil/Nil.vdmsl.result | 1 + .../simple_pattern/Quote/Entry.java | 52 +++++++++++++ .../simple_pattern/Quote/Quote.vdmsl | 25 +++++++ .../simple_pattern/Quote/Quote.vdmsl.result | 1 + .../simple_pattern/Real/Entry.java | 51 +++++++++++++ .../simple_pattern/Real/Real.vdmsl | 25 +++++++ .../simple_pattern/Real/Real.vdmsl.result | 1 + .../simple_pattern/String/Entry.java | 51 +++++++++++++ .../simple_pattern/String/String.vdmsl | 25 +++++++ .../simple_pattern/String/String.vdmsl.result | 1 + 21 files changed, 578 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Bool.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Bool.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Char.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Char.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Int.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Int.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Nil.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Nil.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Quote.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Quote.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Real.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Real.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/String.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/String.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Bool.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Bool.vdmsl new file mode 100644 index 0000000000..56063c8108 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Bool.vdmsl @@ -0,0 +1,25 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> bool +f () == +let true = true +in + true; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Bool.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Bool.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Bool.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Entry.java new file mode 100644 index 0000000000..cd424feb00 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Bool/Entry.java @@ -0,0 +1,51 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Boolean ignorePattern_1 = f(); + + //@ assert Utils.is_bool(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Boolean f() { + Boolean boolPattern_1 = true; + + //@ assert Utils.is_bool(boolPattern_1); + Boolean success_1 = Utils.equals(boolPattern_1, true); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + throw new RuntimeException("Bool pattern match failed"); + } + + Boolean ret_1 = true; + + //@ assert Utils.is_bool(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Char.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Char.vdmsl new file mode 100644 index 0000000000..0932ed9f56 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Char.vdmsl @@ -0,0 +1,25 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> char +f () == +let 'a' in set {'a'} +in + 'a'; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Char.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Char.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Char.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Entry.java new file mode 100644 index 0000000000..b022b686fc --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Char/Entry.java @@ -0,0 +1,73 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Character ignorePattern_1 = f(); + + //@ assert Utils.is_char(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Character f() { + Character letBeStExp_1 = null; + Character charPattern_1 = null; + + Boolean success_1 = false; + + //@ assert Utils.is_bool(success_1); + VDMSet set_1 = SetUtil.set('a'); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_char(V2J.get(set_1,i)))); + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && !(success_1);) { + charPattern_1 = ((Character) iterator_1.next()); + //@ assert Utils.is_char(charPattern_1); + success_1 = Utils.equals(charPattern_1, 'a'); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + continue; + } + + success_1 = true; + + //@ assert Utils.is_bool(success_1); + } + + if (!(success_1)) { + throw new RuntimeException("Let Be St found no applicable bindings"); + } + + letBeStExp_1 = 'a'; + + //@ assert Utils.is_char(letBeStExp_1); + Character ret_1 = letBeStExp_1; + + //@ assert Utils.is_char(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Entry.java new file mode 100644 index 0000000000..88c8ff8a19 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Entry.java @@ -0,0 +1,49 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(1L); + + //@ assert Utils.is_nat(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number f(final Number intPattern_1) { + //@ assert Utils.is_nat(intPattern_1); + Boolean success_1 = Utils.equals(intPattern_1, 1L); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + throw new RuntimeException("Integer pattern match failed"); + } + + Number ret_1 = 2L; + + //@ assert Utils.is_nat(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Int.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Int.vdmsl new file mode 100644 index 0000000000..237e7b77ce --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Int.vdmsl @@ -0,0 +1,23 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f(1) in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : nat -> nat +f (1) == + 2; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Int.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Int.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Int/Int.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Entry.java new file mode 100644 index 0000000000..a51dbaff4e --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Entry.java @@ -0,0 +1,71 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(); + + //@ assert ((ignorePattern_1 == null) || Utils.is_nat(ignorePattern_1)); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number f() { + Object letBeStExp_1 = null; + Object nullPattern_1 = null; + + Boolean success_1 = false; + + //@ assert Utils.is_bool(success_1); + VDMSet set_1 = SetUtil.set(null); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); true)); + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && !(success_1);) { + nullPattern_1 = ((Object) iterator_1.next()); + success_1 = Utils.equals(nullPattern_1, null); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + continue; + } + + success_1 = true; + + //@ assert Utils.is_bool(success_1); + } + + if (!(success_1)) { + throw new RuntimeException("Let Be St found no applicable bindings"); + } + + letBeStExp_1 = null; + + Number ret_1 = ((Number) letBeStExp_1); + + //@ assert ((ret_1 == null) || Utils.is_nat(ret_1)); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Nil.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Nil.vdmsl new file mode 100644 index 0000000000..2aaf774fae --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Nil.vdmsl @@ -0,0 +1,25 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> [nat] +f () == +let nil in set {nil} +in + nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Nil.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Nil.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Nil/Nil.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Entry.java new file mode 100644 index 0000000000..d8ccd4ba75 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Entry.java @@ -0,0 +1,52 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + project.quotes.AQuote ignorePattern_1 = f(); + + //@ assert Utils.is_(ignorePattern_1,project.quotes.AQuote.class); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static project.quotes.AQuote f() { + project.quotes.AQuote quotePattern_1 = project.quotes.AQuote.getInstance(); + + //@ assert Utils.is_(quotePattern_1,project.quotes.AQuote.class); + Boolean success_1 = Utils.equals(quotePattern_1, + project.quotes.AQuote.getInstance()); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + throw new RuntimeException("Quote pattern match failed"); + } + + project.quotes.AQuote ret_1 = project.quotes.AQuote.getInstance(); + + //@ assert Utils.is_(ret_1,project.quotes.AQuote.class); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Quote.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Quote.vdmsl new file mode 100644 index 0000000000..947fea705d --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Quote.vdmsl @@ -0,0 +1,25 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> +f () == +let = +in + ; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Quote.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Quote.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Quote/Quote.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Entry.java new file mode 100644 index 0000000000..abc14215e3 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Entry.java @@ -0,0 +1,51 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(); + + //@ assert Utils.is_real(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number f() { + Number realPattern_1 = 1.5; + + //@ assert Utils.is_real(realPattern_1); + Boolean success_1 = Utils.equals(realPattern_1, 1.5); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + throw new RuntimeException("Real pattern match failed"); + } + + Number ret_1 = 1.5; + + //@ assert Utils.is_real(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Real.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Real.vdmsl new file mode 100644 index 0000000000..dc4cc52fd1 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Real.vdmsl @@ -0,0 +1,25 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> real +f () == +let 1.5 = 1.5 +in + 1.5; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Real.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Real.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/Real/Real.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/Entry.java new file mode 100644 index 0000000000..e44c0024d2 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/Entry.java @@ -0,0 +1,51 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + String ignorePattern_1 = f(); + + //@ assert Utils.is_(ignorePattern_1,String.class); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static String f() { + String stringPattern_1 = "a"; + + //@ assert Utils.is_(stringPattern_1,String.class); + Boolean success_1 = Utils.equals(stringPattern_1, "a"); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + throw new RuntimeException("String pattern match failed"); + } + + String ret_1 = "a"; + + //@ assert Utils.is_(ret_1,String.class); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/String.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/String.vdmsl new file mode 100644 index 0000000000..fda436e57c --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/String.vdmsl @@ -0,0 +1,25 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> seq of char +f () == +let "a" = "a" +in + "a"; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/String.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/String.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/simple_pattern/String/String.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file From 5ba5490ef3e9b793e3cf5552e9694a9b15250ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 16:30:18 +0200 Subject: [PATCH 236/706] Add checking of string types --- .../codegen/vdm2jml/predgen/info/LeafTypeInfo.java | 7 ++++++- .../java/org/overture/vdm2jml/tests/LeafTypeCallTests.java | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java index 07658f280f..dc9c249c07 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/LeafTypeInfo.java @@ -15,6 +15,7 @@ import org.overture.codegen.cgast.types.ARatNumericBasicTypeCG; import org.overture.codegen.cgast.types.ARealNumericBasicTypeCG; import org.overture.codegen.cgast.types.ARecordTypeCG; +import org.overture.codegen.cgast.types.AStringTypeCG; import org.overture.codegen.cgast.types.ATokenBasicTypeCG; import org.overture.codegen.logging.Logger; import org.overture.codegen.runtime.Utils; @@ -53,7 +54,7 @@ public class LeafTypeInfo extends AbstractTypeInfo utilsCallMap.put(ATokenBasicTypeCG.class, IS_TOKEN); utilsCallMap.put(AQuoteTypeCG.class, IS); utilsCallMap.put(ARecordTypeCG.class, IS); - //TODO: String types need treatment + utilsCallMap.put(AStringTypeCG.class, IS); } public LeafTypeInfo(STypeCG type, boolean optional) @@ -124,6 +125,10 @@ else if(type instanceof ARecordTypeCG) call = consSubjectCheckForType(methodName, arg, fullyQualifiedRecType); } + else if(type instanceof AStringTypeCG) + { + call = consSubjectCheckForType(methodName, arg, String.class.getSimpleName()); + } else { call = consSubjectCheck(methodName, arg); diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java index 48a849e019..915ebee391 100644 --- a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/LeafTypeCallTests.java @@ -15,6 +15,7 @@ import org.overture.codegen.cgast.types.ARatNumericBasicTypeCG; import org.overture.codegen.cgast.types.ARealNumericBasicTypeCG; import org.overture.codegen.cgast.types.ARecordTypeCG; +import org.overture.codegen.cgast.types.AStringTypeCG; import org.overture.codegen.cgast.types.ATokenBasicTypeCG; import org.overture.codegen.runtime.Utils; import org.overture.codegen.vdm2jml.predgen.info.LeafTypeInfo; @@ -80,6 +81,12 @@ public void recTest() { assertMethod(ARecordTypeCG.class, Object.class, Class.class); } + + @Test + public void stringTest() + { + assertMethod(AStringTypeCG.class, Object.class, Class.class); + } private void assertMethod(Class type, Class... paramTypes) { From 1372d5e45388023fd8e9ce3a5f4f6f052e33c409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 16:50:08 +0200 Subject: [PATCH 237/706] Prepare testing of JML generation of tuple and record patterns --- .../exec/JmlComposedPatternExecTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComposedPatternExecTests.java diff --git a/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComposedPatternExecTests.java b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComposedPatternExecTests.java new file mode 100644 index 0000000000..83feea0248 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/java/org/overture/vdm2jml/tests/exec/JmlComposedPatternExecTests.java @@ -0,0 +1,34 @@ +package org.overture.vdm2jml.tests.exec; + +import java.io.File; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.overture.codegen.utils.GeneralUtils; +import org.overture.vdm2jml.tests.util.TestUtil; + +@RunWith(Parameterized.class) +public class JmlComposedPatternExecTests extends JmlExecTestBase +{ + public static final String TEST_DIR = JmlExecTestBase.TEST_RES_DYNAMIC_ANALYSIS_ROOT + "composed_pattern"; + + public static final String PROPERTY_ID = "composed_pattern"; + + public JmlComposedPatternExecTests(File inputFile) + { + super(inputFile); + } + + @Parameters(name = "{index}: {0}") + public static Collection data() + { + return TestUtil.collectVdmslFiles(GeneralUtils.getFilesRecursively(new File(TEST_DIR))); + } + + protected String getPropertyId() + { + return PROPERTY_ID; + } +} From 8f83fe1323965f573b1966a0f662ea96fe7cbf52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 16:50:36 +0200 Subject: [PATCH 238/706] Add tests to exercise JML generation of tuple and record patterns --- .../composed_pattern/RecLet/Entry.java | 60 +++++++++++++ .../composed_pattern/RecLet/R.java | 86 +++++++++++++++++++ .../composed_pattern/RecLet/RecLet.vdmsl | 31 +++++++ .../RecLet/RecLet.vdmsl.result | 1 + .../composed_pattern/RecParam/Entry.java | 79 +++++++++++++++++ .../composed_pattern/RecParam/R.java | 66 ++++++++++++++ .../composed_pattern/RecParam/RecParam.vdmsl | 30 +++++++ .../RecParam/RecParam.vdmsl.result | 1 + .../composed_pattern/TupLet/Entry.java | 63 ++++++++++++++ .../composed_pattern/TupLet/TupLet.vdmsl | 25 ++++++ .../TupLet/TupLet.vdmsl.result | 1 + .../composed_pattern/TupParam/Entry.java | 58 +++++++++++++ .../composed_pattern/TupParam/TupParam.vdmsl | 23 +++++ .../TupParam/TupParam.vdmsl.result | 1 + 14 files changed, 525 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/R.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/RecLet.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/RecLet.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/R.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/RecParam.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/RecParam.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/TupLet.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/TupLet.vdmsl.result create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/TupParam.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/TupParam.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/Entry.java new file mode 100644 index 0000000000..9f89594ff6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/Entry.java @@ -0,0 +1,60 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(); + + //@ assert Utils.is_nat(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number f() { + project.Entrytypes.R recordPattern_1 = new project.Entrytypes.R(1L, 2L); + + //@ assert Utils.is_(recordPattern_1,project.Entrytypes.R.class); + Boolean success_1 = true; + + //@ assert Utils.is_bool(success_1); + Number a = null; + + Number b = null; + + a = recordPattern_1.get_x(); + //@ assert Utils.is_nat(a); + b = recordPattern_1.get_y(); + + //@ assert Utils.is_nat(b); + if (!(success_1)) { + throw new RuntimeException("Record pattern match failed"); + } + + Number ret_1 = a.longValue() + b.longValue(); + + //@ assert Utils.is_nat(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/R.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/R.java new file mode 100644 index 0000000000..7d502ebb1f --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/R.java @@ -0,0 +1,86 @@ +package project.Entrytypes; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class R implements Record { + public Number x; + public Number y; + + public R(final Number _x, final Number _y) { + //@ assert Utils.is_nat(_x); + + //@ assert Utils.is_nat(_y); + x = _x; + //@ assert Utils.is_nat(x); + y = _y; + + //@ assert Utils.is_nat(y); + } + + /*@ pure @*/ + public boolean equals(final Object obj) { + if (!(obj instanceof project.Entrytypes.R)) { + return false; + } + + project.Entrytypes.R other = ((project.Entrytypes.R) obj); + + return (Utils.equals(x, other.x)) && (Utils.equals(y, other.y)); + } + + /*@ pure @*/ + public int hashCode() { + return Utils.hashCode(x, y); + } + + /*@ pure @*/ + public project.Entrytypes.R copy() { + return new project.Entrytypes.R(x, y); + } + + /*@ pure @*/ + public String toString() { + return "mk_Entry`R" + Utils.formatFields(x, y); + } + + /*@ pure @*/ + public Number get_x() { + Number ret_2 = x; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_2)); + return ret_2; + } + + public void set_x(final Number _x) { + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_x)); + x = _x; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(x)); + } + + /*@ pure @*/ + public Number get_y() { + Number ret_3 = y; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(ret_3)); + return ret_3; + } + + public void set_y(final Number _y) { + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(_y)); + y = _y; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_nat(y)); + } + + /*@ pure @*/ + public Boolean valid() { + return true; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/RecLet.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/RecLet.vdmsl new file mode 100644 index 0000000000..2d40fb3ff7 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/RecLet.vdmsl @@ -0,0 +1,31 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +R :: + x : nat + y : nat; + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> nat +f () == +let mk_R(a,b) = mk_R(1,2) +in + a + b; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/RecLet.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/RecLet.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecLet/RecLet.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/Entry.java new file mode 100644 index 0000000000..3666b34b0c --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/Entry.java @@ -0,0 +1,79 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Boolean ignorePattern_1 = f(); + + //@ assert Utils.is_bool(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Boolean f() { + Boolean letBeStExp_1 = null; + project.Entrytypes.R recordPattern_1 = null; + + Boolean success_1 = false; + + //@ assert Utils.is_bool(success_1); + VDMSet set_1 = SetUtil.set(new project.Entrytypes.R(false), + new project.Entrytypes.R(true)); + + //@ assert (V2J.isSet(set_1) && (\forall int i; 0 <= i && i < V2J.size(set_1); Utils.is_(V2J.get(set_1,i),project.Entrytypes.R.class))); + for (Iterator iterator_1 = set_1.iterator(); + iterator_1.hasNext() && !(success_1);) { + recordPattern_1 = ((project.Entrytypes.R) iterator_1.next()); + //@ assert Utils.is_(recordPattern_1,project.Entrytypes.R.class); + success_1 = true; + + //@ assert Utils.is_bool(success_1); + Boolean boolPattern_1 = recordPattern_1.get_b(); + //@ assert Utils.is_bool(boolPattern_1); + success_1 = Utils.equals(boolPattern_1, true); + + //@ assert Utils.is_bool(success_1); + if (!(success_1)) { + continue; + } + + success_1 = true; + + //@ assert Utils.is_bool(success_1); + } + + if (!(success_1)) { + throw new RuntimeException("Let Be St found no applicable bindings"); + } + + letBeStExp_1 = true; + + //@ assert Utils.is_bool(letBeStExp_1); + Boolean ret_1 = letBeStExp_1; + + //@ assert Utils.is_bool(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/R.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/R.java new file mode 100644 index 0000000000..dab133c4de --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/R.java @@ -0,0 +1,66 @@ +package project.Entrytypes; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class R implements Record { + public Boolean b; + + public R(final Boolean _b) { + //@ assert Utils.is_bool(_b); + b = _b; + + //@ assert Utils.is_bool(b); + } + + /*@ pure @*/ + public boolean equals(final Object obj) { + if (!(obj instanceof project.Entrytypes.R)) { + return false; + } + + project.Entrytypes.R other = ((project.Entrytypes.R) obj); + + return Utils.equals(b, other.b); + } + + /*@ pure @*/ + public int hashCode() { + return Utils.hashCode(b); + } + + /*@ pure @*/ + public project.Entrytypes.R copy() { + return new project.Entrytypes.R(b); + } + + /*@ pure @*/ + public String toString() { + return "mk_Entry`R" + Utils.formatFields(b); + } + + /*@ pure @*/ + public Boolean get_b() { + Boolean ret_2 = b; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_bool(ret_2)); + return ret_2; + } + + public void set_b(final Boolean _b) { + //@ assert project.Entry.invChecksOn ==> (Utils.is_bool(_b)); + b = _b; + + //@ assert project.Entry.invChecksOn ==> (Utils.is_bool(b)); + } + + /*@ pure @*/ + public Boolean valid() { + return true; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/RecParam.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/RecParam.vdmsl new file mode 100644 index 0000000000..92767bf516 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/RecParam.vdmsl @@ -0,0 +1,30 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +R :: + b : bool; + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> bool +f () == +let mk_R(true) in set {mk_R(false), mk_R(true)} +in + true; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/RecParam.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/RecParam.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/RecParam/RecParam.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/Entry.java new file mode 100644 index 0000000000..93e8bc2384 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/Entry.java @@ -0,0 +1,63 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(); + + //@ assert Utils.is_nat(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number f() { + Tuple tuplePattern_1 = Tuple.mk_(1L, 2L); + + //@ assert (V2J.isTup(tuplePattern_1,2) && Utils.is_nat1(V2J.field(tuplePattern_1,0)) && Utils.is_nat1(V2J.field(tuplePattern_1,1))); + Boolean success_1 = tuplePattern_1.compatible(Number.class, Number.class); + + //@ assert Utils.is_bool(success_1); + Number a = null; + + Number b = null; + + if (success_1) { + a = ((Number) tuplePattern_1.get(0)); + //@ assert Utils.is_nat1(a); + b = ((Number) tuplePattern_1.get(1)); + + //@ assert Utils.is_nat1(b); + } + + if (!(success_1)) { + throw new RuntimeException("Tuple pattern match failed"); + } + + Number ret_1 = a.longValue() + b.longValue(); + + //@ assert Utils.is_nat(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/TupLet.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/TupLet.vdmsl new file mode 100644 index 0000000000..1a68c64be0 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/TupLet.vdmsl @@ -0,0 +1,25 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f() in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : () -> nat +f () == +let mk_(a,b) = mk_(1,2) +in + a + b; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/TupLet.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/TupLet.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupLet/TupLet.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/Entry.java new file mode 100644 index 0000000000..f1176cfc64 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/Entry.java @@ -0,0 +1,58 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + { + Number ignorePattern_1 = f(Tuple.mk_(4L, 'a')); + + //@ assert Utils.is_nat(ignorePattern_1); + + /* skip */ + } + + IO.println("Done! Expected no violations"); + + return 0L; + } + + /*@ pure @*/ + public static Number f(final Tuple tuplePattern_1) { + //@ assert (V2J.isTup(tuplePattern_1,2) && Utils.is_nat(V2J.field(tuplePattern_1,0)) && Utils.is_char(V2J.field(tuplePattern_1,1))); + Boolean success_1 = tuplePattern_1.compatible(Number.class, + Character.class); + + //@ assert Utils.is_bool(success_1); + Number a = null; + + if (success_1) { + a = ((Number) tuplePattern_1.get(0)); + + //@ assert Utils.is_nat(a); + } + + if (!(success_1)) { + throw new RuntimeException("Tuple pattern match failed"); + } + + Number ret_1 = a; + + //@ assert Utils.is_nat(ret_1); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/TupParam.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/TupParam.vdmsl new file mode 100644 index 0000000000..0bbb7832b3 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/TupParam.vdmsl @@ -0,0 +1,23 @@ +module Entry + +exports all +imports from IO all +definitions + +operations + +Run : () ==> ? +Run () == +( + let - = f(mk_(4,'a')) in skip; + IO`println("Done! Expected no violations"); + return 0; +); + +functions + +f : (nat * char) -> nat +f (mk_(a,-)) == + a; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/TupParam.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/TupParam.vdmsl.result new file mode 100644 index 0000000000..0b8f37fec6 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/composed_pattern/TupParam/TupParam.vdmsl.result @@ -0,0 +1 @@ +"Done! Expected no violations" \ No newline at end of file From c55932d2ac9ffe98cc5e1a211a14c0673a129df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 17:17:07 +0200 Subject: [PATCH 239/706] Cut more uses of IR 'null' --- .../src/test/java/org/overture/codegen/tests/other/IRTest.java | 2 +- .../java/org/overture/codegen/assistant/DeclAssistantCG.java | 2 +- .../java/org/overture/codegen/traces/TraceLetBeStStrategy.java | 2 +- .../org/overture/codegen/trans/uniontypes/UnionTypeTrans.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/codegen/javagen/src/test/java/org/overture/codegen/tests/other/IRTest.java b/core/codegen/javagen/src/test/java/org/overture/codegen/tests/other/IRTest.java index c9e7df4883..945cdf4a1f 100644 --- a/core/codegen/javagen/src/test/java/org/overture/codegen/tests/other/IRTest.java +++ b/core/codegen/javagen/src/test/java/org/overture/codegen/tests/other/IRTest.java @@ -111,7 +111,7 @@ public void testFinalVarDecl() id.setName("x"); AVarDeclCG varDecl = javaCodeGen.getInfo().getDeclAssistant(). - consLocalVarDecl(new ARealNumericBasicTypeCG(), id, javaCodeGen.getInfo().getExpAssistant().consNullExp()); + consLocalVarDecl(new ARealNumericBasicTypeCG(), id, javaCodeGen.getInfo().getExpAssistant().consUndefinedExp()); varDecl.setFinal(true); String expected = "final Number x = null;"; diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java index eab693a43c..a9184a8d0c 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/assistant/DeclAssistantCG.java @@ -636,7 +636,7 @@ else if (typeCg instanceof ARealNumericBasicTypeCG) localDecl.setExp(expAssistant.getDefaultBoolValue()); } else { - localDecl.setExp(assistantManager.getExpAssistant().consNullExp()); + localDecl.setExp(assistantManager.getExpAssistant().consUndefinedExp()); } } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceLetBeStStrategy.java b/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceLetBeStStrategy.java index 55ed6e535c..73f43003a8 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceLetBeStStrategy.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/traces/TraceLetBeStStrategy.java @@ -56,7 +56,7 @@ public List getOuterBlockDecls(AIdentifierVarExpCG setVar, for (SPatternCG id : patterns) { AVarDeclCG decl = transAssistant.getInfo().getDeclAssistant(). - consLocalVarDecl(setType.getSetOf().clone(), id.clone(), transAssistant.getInfo().getExpAssistant().consNullExp()); + consLocalVarDecl(setType.getSetOf().clone(), id.clone(), transAssistant.getInfo().getExpAssistant().consUndefinedExp()); decl.setFinal(true); decls.add(decl); } diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java index 64245062c6..97d3ed1438 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/trans/uniontypes/UnionTypeTrans.java @@ -363,7 +363,7 @@ private void handleFieldExp(SExpCG node, String memberName, SExpCG subject, STyp id.setName(applyResultName); AVarDeclCG resultDecl = transAssistant.getInfo().getDeclAssistant(). - consLocalVarDecl(node.getSourceNode().getVdmNode(), resultType, id, transAssistant.getInfo().getExpAssistant().consNullExp()); + consLocalVarDecl(node.getSourceNode().getVdmNode(), resultType, id, transAssistant.getInfo().getExpAssistant().consUndefinedExp()); AIdentifierVarExpCG resultVar = new AIdentifierVarExpCG(); resultVar.setSourceNode(node.getSourceNode()); From 069fa14df49dcaf8f854fec715b729a2fa02ab7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Wed, 21 Oct 2015 21:35:51 +0200 Subject: [PATCH 240/706] Clear warnings in maven codegen plugin --- .../org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/codegen/codegen-maven-plugin/src/main/java/org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java b/core/codegen/codegen-maven-plugin/src/main/java/org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java index dfcda0dcbd..bbac8500d0 100644 --- a/core/codegen/codegen-maven-plugin/src/main/java/org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java +++ b/core/codegen/codegen-maven-plugin/src/main/java/org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java @@ -32,7 +32,7 @@ public abstract class Vdm2JavaBaseMojo extends AbstractMojo /** * Name of the directory into which the astCreatorPlugin should dump the ast files. * - * @parameter expression="${project.build.directory}/generated-sources/vdmCodeGen" + * @parameter property="${project.build.directory}/generated-sources/vdmCodeGen" */ protected File outputDirectory; @@ -60,7 +60,7 @@ public abstract class Vdm2JavaBaseMojo extends AbstractMojo protected boolean formatCode = true; /** - * @parameter expression="${project}" + * @parameter property="project" * @required * @readonly */ From 5f29f0c9cf5b946e057731e8f044672ea901e75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 24 Oct 2015 23:56:41 +0200 Subject: [PATCH 241/706] Add test revealing problem with checking of named type invariants that are used as optional types --- .../NamedTypeMadeOptional/Entry.java | 62 +++++++++++++++++++ .../NamedTypeMadeOptional.vdmsl | 38 ++++++++++++ .../NamedTypeMadeOptional.vdmsl.result | 7 +++ 3 files changed, 107 insertions(+) create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/Entry.java create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/NamedTypeMadeOptional.vdmsl create mode 100644 core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/NamedTypeMadeOptional.vdmsl.result diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/Entry.java b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/Entry.java new file mode 100644 index 0000000000..74db6b4361 --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/Entry.java @@ -0,0 +1,62 @@ +package project; + +import org.overture.codegen.runtime.*; +import org.overture.codegen.vdm2jml.runtime.*; + +import java.util.*; + + +//@ nullable_by_default +@SuppressWarnings("all") +final public class Entry { + /*@ public ghost static boolean invChecksOn = true; @*/ + private Entry() { + } + + public static Object Run() { + IO.println("Before valid use"); + + { + Number e = 2L; + //@ assert ((e == null) || Utils.is_nat(e) && inv_Entry_Even(e)); + e = null; + + //@ assert ((e == null) || Utils.is_nat(e) && inv_Entry_Even(e)); + } + + IO.println("After valid use"); + IO.println("Before invalid use"); + + { + Number e = 2L; + //@ assert (Utils.is_nat(e) && inv_Entry_Even(e)); + e = Nil(); + + //@ assert (Utils.is_nat(e) && inv_Entry_Even(e)); + } + + IO.println("After invalid use"); + + return 0L; + } + + /*@ pure @*/ + public static Number Nil() { + Number ret_1 = null; + + //@ assert ((ret_1 == null) || Utils.is_nat(ret_1) && inv_Entry_Even(ret_1)); + return ret_1; + } + + public String toString() { + return "Entry{}"; + } + + /*@ pure @*/ + /*@ helper @*/ + public static Boolean inv_Entry_Even(final Object check_e) { + Number e = ((Number) check_e); + + return Utils.equals(Utils.mod(e.longValue(), 2L), 0L); + } +} diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/NamedTypeMadeOptional.vdmsl b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/NamedTypeMadeOptional.vdmsl new file mode 100644 index 0000000000..7624534eab --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/NamedTypeMadeOptional.vdmsl @@ -0,0 +1,38 @@ +module Entry + +exports all +imports from IO all +definitions + +types + +Even = nat +inv e == e mod 2 = 0; + +operations + +Run : () ==> ? +Run () == +( + IO`println("Before valid use"); + ( + dcl e : [Even] := 2; + e := nil; + ); + IO`println("After valid use"); + + IO`println("Before invalid use"); + ( + dcl e : Even := 2; + e := Nil(); + ); + IO`println("After invalid use"); + return 0; +); + +functions + +Nil : () -> [Even] +Nil () == nil; + +end Entry \ No newline at end of file diff --git a/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/NamedTypeMadeOptional.vdmsl.result b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/NamedTypeMadeOptional.vdmsl.result new file mode 100644 index 0000000000..406d05591e --- /dev/null +++ b/core/codegen/vdm2jml/src/test/resources/dynamic_analysis/namedtypeinv/NamedTypeMadeOptional/NamedTypeMadeOptional.vdmsl.result @@ -0,0 +1,7 @@ +"Before valid use" +"After valid use" +"Before invalid use" +Entry.java:35: JML assertion is false + //@ assert (Utils.is_nat(e) && inv_Entry_Even(e)); + ^ +"After invalid use" \ No newline at end of file From 28211ea740835e7b6b9630f61bdba58d11458a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Sat, 24 Oct 2015 23:58:05 +0200 Subject: [PATCH 242/706] Fix for checking of named type invariants that are used as optional types --- .../codegen/vdm2jml/predgen/TypePredUtil.java | 13 +++++++------ .../codegen/vdm2jml/predgen/info/NamedTypeInfo.java | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java index c733873775..f16a24ccc2 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/TypePredUtil.java @@ -74,14 +74,12 @@ public List consJmlCheck(String enclosingClass, String jmlVisibility, inv.append('('); } - String or = ""; String javaPackage = handler.getJmlGen().getJavaSettings().getJavaRootPackage(); //TODO: Add names of parameters of the enclosing method to 'names-to-avoid' in name generator NameGen nameGen = new NameGen(); String consCheckExp = typeInfo.consCheckExp(enclosingClass, javaPackage, var.getName(), nameGen); - inv.append(or); if (consCheckExp != null) { inv.append(consCheckExp); @@ -92,8 +90,6 @@ public List consJmlCheck(String enclosingClass, String jmlVisibility, // TODO: Consider better handling inv.append("true"); } - or = JmlGenerator.JML_OR; - if(invChecksGuard) { inv.append(')'); @@ -216,6 +212,8 @@ public AMetaStmCG consVarNotNullAssert(String varName) public AbstractTypeInfo findTypeInfo(STypeCG type) { + TypeAssistantCG assist = handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant(); + if (type.getNamedInvType() != null) { ANamedTypeDeclCG namedInv = type.getNamedInvType(); @@ -224,6 +222,11 @@ public AbstractTypeInfo findTypeInfo(STypeCG type) String typeName = namedInv.getName().getName(); NamedTypeInfo info = NamedTypeInvDepCalculator.findTypeInfo(handler.getJmlGen().getTypeInfoList(), defModule, typeName); + + if(assist.allowsNull(type)) + { + info = new NamedTypeInfo(info.getTypeName(), info.getDefModule(), info.hasInv(), true, info.getDomainType()); + } if (info == null) { @@ -237,8 +240,6 @@ public AbstractTypeInfo findTypeInfo(STypeCG type) // We do not need to collect sub named invariant types } else { - TypeAssistantCG assist = handler.getJmlGen().getJavaGen().getInfo().getTypeAssistant(); - if (type instanceof AUnionTypeCG) { List types = new LinkedList<>(); diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java index 49bf184bfa..dfbca4d34a 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/predgen/info/NamedTypeInfo.java @@ -36,7 +36,12 @@ public boolean hasInv() { return hasInv; } - + + public AbstractTypeInfo getDomainType() + { + return domainType; + } + @Override public int hashCode() { From eb15364f575b006fb6ba115923153554fad8b559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Mon, 26 Oct 2015 17:48:30 +0100 Subject: [PATCH 243/706] Fix for maven code generator plugin properties --- .../org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/codegen/codegen-maven-plugin/src/main/java/org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java b/core/codegen/codegen-maven-plugin/src/main/java/org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java index bbac8500d0..dfcda0dcbd 100644 --- a/core/codegen/codegen-maven-plugin/src/main/java/org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java +++ b/core/codegen/codegen-maven-plugin/src/main/java/org/overture/tools/maven/astcreator/Vdm2JavaBaseMojo.java @@ -32,7 +32,7 @@ public abstract class Vdm2JavaBaseMojo extends AbstractMojo /** * Name of the directory into which the astCreatorPlugin should dump the ast files. * - * @parameter property="${project.build.directory}/generated-sources/vdmCodeGen" + * @parameter expression="${project.build.directory}/generated-sources/vdmCodeGen" */ protected File outputDirectory; @@ -60,7 +60,7 @@ public abstract class Vdm2JavaBaseMojo extends AbstractMojo protected boolean formatCode = true; /** - * @parameter property="project" + * @parameter expression="${project}" * @required * @readonly */ From 5c2db446239429445557c29ceeee0f93a0f34b3a Mon Sep 17 00:00:00 2001 From: Luis Diogo Couto Date: Tue, 27 Oct 2015 14:29:24 +0100 Subject: [PATCH 244/706] Guard against null pointer when checking quotes for errors. Issue: --- .../overture/codegen/utils/GeneratedData.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/core/codegen/platform/src/main/java/org/overture/codegen/utils/GeneratedData.java b/core/codegen/platform/src/main/java/org/overture/codegen/utils/GeneratedData.java index 24ca70e0eb..467e049e1f 100644 --- a/core/codegen/platform/src/main/java/org/overture/codegen/utils/GeneratedData.java +++ b/core/codegen/platform/src/main/java/org/overture/codegen/utils/GeneratedData.java @@ -34,12 +34,14 @@ public class GeneratedData private List skippedClasses; private List allRenamings; private List warnings; - - public GeneratedData() { + + public GeneratedData() + { } - + public GeneratedData(List classes, - List quoteValues, InvalidNamesResult invalidNamesResult, List skippedClasses) + List quoteValues, + InvalidNamesResult invalidNamesResult, List skippedClasses) { super(); this.classes = classes; @@ -62,7 +64,7 @@ public void setClasses(List classes) { this.classes = classes; } - + public List getQuoteValues() { return quoteValues; @@ -77,27 +79,27 @@ public InvalidNamesResult getInvalidNamesResult() { return invalidNamesResult; } - + public void setInvalidNamesResult(InvalidNamesResult invalidNamesResult) { this.invalidNamesResult = invalidNamesResult; } - + public List getSkippedClasses() { return skippedClasses; } - + public void setSkippedClasses(List skippedClasses) { this.skippedClasses = skippedClasses; } - + public List getAllRenamings() { return allRenamings; } - + public void setAllRenamings(List allRenamings) { this.allRenamings = allRenamings; @@ -112,17 +114,19 @@ public void setWarnings(List warnings) { this.warnings = warnings; } - + private boolean hasErrors(List modules) { - for(GeneratedModule clazz : modules) + if (modules != null) { - if(clazz.hasErrors()) + for (GeneratedModule clazz : modules) { - return true; + if (clazz.hasErrors()) + { + return true; + } } } - return false; } } From b17e2271aa6a71759c99f7606ce1d30998ff52e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=2E=20V=2E=20Tran-J=C3=B8rgensen?= Date: Thu, 29 Oct 2015 14:50:41 +0100 Subject: [PATCH 245/706] Add template for literate VDM Close #473 --- ide/ui/src/resources/templates.txt | 8 ++++++++ ide/vdmpp/ui/templates/templates.xml | 7 +++++++ ide/vdmrt/ui/templates/templates.xml | 7 +++++++ ide/vdmsl/ui/templates/templates.xml | 8 +++++++- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ide/ui/src/resources/templates.txt b/ide/ui/src/resources/templates.txt index 5d4e05f7e1..e07b55d765 100644 --- a/ide/ui/src/resources/templates.txt +++ b/ide/ui/src/resources/templates.txt @@ -22,6 +22,14 @@ -- VDM Shared constructs -- --================================================================== +#name literateVdm +#description Literate VDM +#begin +\begin{vdm_al} +${cursor} +\end{vdm_al} +#end +-------------------------------------------------------------------- #name while #description while predicate do statement #dialect all diff --git a/ide/vdmpp/ui/templates/templates.xml b/ide/vdmpp/ui/templates/templates.xml index 72604065f6..fc4434bb83 100644 --- a/ide/vdmpp/ui/templates/templates.xml +++ b/ide/vdmpp/ui/templates/templates.xml @@ -3,6 +3,13 @@ +