Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-05-18 09:27:41 -0400
committerEd Willink2016-05-18 09:29:01 -0400
commita8111521915f7b77e0ec0f53d05f7ce3ea11f5dc (patch)
treeec3db087c8ca98a6ea9d52cc376a488118520767
parent9b53545e2054b2aadfb2146a2c0cadc811fe282d (diff)
downloadorg.eclipse.qvtd-a8111521915f7b77e0ec0f53d05f7ce3ea11f5dc.tar.gz
org.eclipse.qvtd-a8111521915f7b77e0ec0f53d05f7ce3ea11f5dc.tar.xz
org.eclipse.qvtd-a8111521915f7b77e0ec0f53d05f7ce3ea11f5dc.zip
[486722] Eliminate unnecessary non-null enforcement
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
index 2efaf1bf9..23abedff4 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
@@ -1702,14 +1702,20 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append(" = ");
Map<Property, String> oppositeProperties = getGlobalContext().getOppositeProperties();
if (oppositeProperties != null) {
+ boolean isRequired = cgPropertyCallExp.isRequired();
String cacheName = oppositeProperties.get(asProperty);
if (cacheName != null) {
- js.appendClassReference(ClassUtil.class);
- js.append(".nonNullState (");
+ if (isRequired) {
+ js.appendClassReference(ClassUtil.class);
+ js.append(".nonNullState (");
+ }
js.append(cacheName);
js.append(".get(");
js.appendValueName(source);
- js.append("))");
+ js.append(")");
+ if (isRequired) {
+ js.append(")");
+ }
}
js.append(";\n");
}

Back to the top