Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2018-01-05 16:16:05 -0500
committerHenrik Rentz-Reichert2018-01-08 14:47:48 -0500
commit33e5411e9632baa741e2e93e91922cd40693cfd3 (patch)
tree1814b0a170406345b83937901b928040fd58c6a9 /plugins/org.eclipse.etrice.generator.java/src/org
parent97db531e8fa6d639abf4ac2bbbb1dbdb5ad79f15 (diff)
downloadorg.eclipse.etrice-33e5411e9632baa741e2e93e91922cd40693cfd3.tar.gz
org.eclipse.etrice-33e5411e9632baa741e2e93e91922cd40693cfd3.tar.xz
org.eclipse.etrice-33e5411e9632baa741e2e93e91922cd40693cfd3.zip
Bug 529445 - [newfsmgen] make old style transition data deprecated
Implementation as suggested in the bug. Change-Id: I6a6f6ea966e4060646427078d82cb2b12eb046b6
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.java/src/org')
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend23
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend15
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend19
3 files changed, 30 insertions, 27 deletions
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
index 1bfae882e..4bef3f8b3 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
@@ -33,6 +33,7 @@ import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.etrice.generator.java.Main
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
+import org.eclipse.etrice.generator.generic.ILanguageExtension
@Singleton
class ActorClassGen extends GenericActorClassGenerator {
@@ -75,7 +76,7 @@ class ActorClassGen extends GenericActorClassGenerator {
val models = root.getReferencedModels(ac)
val impPersist = if (Main::settings.generatePersistenceInterface) "implements IPersistable " else ""
val dataObjClass = ac.name+"_DataObject"
- val baseClass = if (ac.actorBase!=null) ac.actorBase.name
+ val baseClass = if (ac.actorBase!==null) ac.actorBase.name
else if (!ac.getAttribute("ActorBaseClass", "class").empty) ac.getAttribute("ActorBaseClass", "class")
else if (Main::settings.generateStoreDataObj) "ActorClassFinalActionBase"
else "ActorClassBase"
@@ -258,12 +259,12 @@ class ActorClassGen extends GenericActorClassGenerator {
switch (evt) {
«FOR msg: ifitem.incoming»
case «msg.protocolClass.name».«if (msg.incoming) "IN_" else "OUT_"»«msg.name»:
- «IF (msg.data!=null)»
+ «IF (msg.data!==null)»
{«msg.typedDataDefinition»
«ENDIF»
- on_«ifitem.name»_«msg.name»(ifitem«IF (msg.data!=null)», «msg.data.name»«ENDIF»);
+ on_«ifitem.name»_«msg.name»(ifitem«IF (msg.data!==null)», «ILanguageExtension.GENERIC_DATA_NAME»«ENDIF»);
break;
- «IF (msg.data!=null)»
+ «IF (msg.data!==null)»
}
«ENDIF»
«ENDFOR»
@@ -273,7 +274,7 @@ class ActorClassGen extends GenericActorClassGenerator {
}
«FOR ifitem : ac.allInterfaceItems»
«FOR msg: ifitem.incoming»
- protected void on_«ifitem.name»_«msg.name»(InterfaceItemBase ifitem«IF msg.data!=null»«msg.data.generateArglistAndTypedData.get(2)»«ENDIF») {}
+ protected void on_«ifitem.name»_«msg.name»(InterfaceItemBase ifitem«IF msg.data!==null»«msg.data.generateArglistAndTypedData.get(2)»«ENDIF») {}
«ENDFOR»
«ENDFOR»
@@ -346,7 +347,7 @@ class ActorClassGen extends GenericActorClassGenerator {
return;
«dataObjClass» dataObject = («dataObjClass») obj;
- «IF ac.actorBase!=null»
+ «IF ac.actorBase!==null»
super.store(dataObject);
«ENDIF»
@@ -385,7 +386,7 @@ class ActorClassGen extends GenericActorClassGenerator {
return;
«dataObjClass» dataObject = («dataObjClass») obj;
- «IF ac.actorBase!=null»
+ «IF ac.actorBase!==null»
super.restore(dataObject);
«ENDIF»
@@ -430,7 +431,7 @@ class ActorClassGen extends GenericActorClassGenerator {
private def genSaveImpl(ExpandedActorClass xpac) {
val ac = xpac.actorClass
'''
- «IF ac.actorBase!=null»
+ «IF ac.actorBase!==null»
super.saveAttributes(output);
«ENDIF»
@@ -454,7 +455,7 @@ class ActorClassGen extends GenericActorClassGenerator {
private def genLoadImpl(ExpandedActorClass xpac) {
val ac = xpac.actorClass
'''
- «IF ac.actorBase!=null»
+ «IF ac.actorBase!==null»
super.loadAttributes(input);
«ENDIF»
@@ -476,7 +477,7 @@ class ActorClassGen extends GenericActorClassGenerator {
}
private def genSavePrimitive(Attribute att) {
- val type = if (att.type.type instanceof EnumerationType && (att.type.type as EnumerationType).primitiveType==null)
+ val type = if (att.type.type instanceof EnumerationType && (att.type.type as EnumerationType).primitiveType===null)
"int"
else
att.type.type.typeName
@@ -503,7 +504,7 @@ class ActorClassGen extends GenericActorClassGenerator {
}
private def genLoadPrimitive(Attribute att) {
- val type = if (att.type.type instanceof EnumerationType && (att.type.type as EnumerationType).primitiveType==null)
+ val type = if (att.type.type instanceof EnumerationType && (att.type.type as EnumerationType).primitiveType===null)
"int"
else
att.type.type.typeName
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
index 2de886d0c..6cb8cf0eb 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
@@ -30,9 +30,9 @@ import org.eclipse.etrice.core.room.EnumLiteral
import org.eclipse.etrice.core.room.EnumerationType
import org.eclipse.etrice.core.room.ExternalType
import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.MessageData
import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.RoomClass
-import org.eclipse.etrice.core.room.VarDecl
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.xtext.util.Pair
@@ -241,16 +241,17 @@ class JavaExtensions implements ILanguageExtension {
}
override generateArglistAndTypedData(EObject d) {
- if (d==null || !(d instanceof VarDecl))
+ // TODO 529445: d will be a RefableType, not MessageData
+ if (d===null || !(d instanceof MessageData))
return newArrayList("", "", "")
- val data = d as VarDecl
+ val data = d as MessageData
var typeName = data.refType.type.name
var castTypeName = typeName
if (data.refType.type instanceof PrimitiveType) {
typeName = (data.refType.type as PrimitiveType).targetName
val ct = (data.refType.type as PrimitiveType).castName
- if (ct!=null && !ct.isEmpty())
+ if (ct!==null && !ct.isEmpty())
castTypeName = ct
}
else if (data.refType.type instanceof EnumerationType) {
@@ -266,7 +267,7 @@ class JavaExtensions implements ILanguageExtension {
}
override getTargetType(EnumerationType type) {
- if (type.primitiveType!=null)
+ if (type.primitiveType!==null)
type.primitiveType.targetName
else
"int"
@@ -276,14 +277,14 @@ class JavaExtensions implements ILanguageExtension {
val type = literal.eContainer() as EnumerationType
val cast = type.targetType
- if (type.primitiveType==null)
+ if (type.primitiveType===null)
Long.toString(literal.literalValue)
else
"(("+cast+")"+Long.toString(literal.literalValue)+")"
}
override getCastType(EnumerationType type) {
- if (type.primitiveType!=null)
+ if (type.primitiveType!==null)
type.primitiveType.castName
else
"int"
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
index d59287f5a..f342e9f87 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
@@ -27,6 +27,7 @@ import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.etrice.generator.java.Main
import org.eclipse.etrice.core.genmodel.fsm.ILogger
+import org.eclipse.etrice.generator.generic.ILanguageExtension
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
@@ -116,7 +117,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// port class
static public class «portClassName» extends PortBase {
- «IF pclass!=null»
+ «IF pclass!==null»
«pclass.userCode.userCode»
«ENDIF»
// constructors
@@ -125,7 +126,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
}
public «portClassName»(IInterfaceItemOwner actor, String name, int localId, int idx) {
super(actor, name, localId, idx);
- «IF pclass!=null»
+ «IF pclass!==null»
«pclass.attributes.attributeInitialization(pclass, true)»
«ENDIF»
«IF Main::settings.generateMSCInstrumentation»
@@ -245,7 +246,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
}
def messageSignature(Message m) {
- '''«IF m.priv»private«ELSE»public«ENDIF» void «m.name»(«IF m.data!=null»«m.data.refType.type.typeName» «m.data.name»«ENDIF»)'''
+ '''«IF m.priv»private«ELSE»public«ENDIF» void «m.name»(«IF m.data!==null»«m.data.refType.type.typeName» «ILanguageExtension.GENERIC_DATA_NAME»«ENDIF»)'''
}
def messageSignatureExplicit(Message m) {
@@ -254,7 +255,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
}
def messageCall(Message m) {
- '''«m.name»(«IF m.data!=null» «m.data.name»«ENDIF»)'''
+ '''«m.name»(«IF m.data!==null» «ILanguageExtension.GENERIC_DATA_NAME»«ENDIF»)'''
}
def sendMessage(Message m, boolean conj) {
@@ -262,7 +263,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
var hdlr = m.getSendHandler(conj)
'''
«messageSignature(m)» {
- «IF hdlr!=null»
+ «IF hdlr!==null»
«FOR command : hdlr.detailCode.lines» «command»
«ENDFOR»
«ELSE»
@@ -270,14 +271,14 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[«dir»_«m.name»]);
«ENDIF»
if (getPeerAddress()!=null)
- «IF m.data==null»
+ «IF m.data===null»
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), «dir»_«m.name»));
«ELSE»
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«m.name», «m.data.name»«IF (!m.data.refType.ref && !(m.data.refType.type.enumerationOrPrimitive))».deepCopy()«ENDIF»));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«m.name», «ILanguageExtension.GENERIC_DATA_NAME»«IF (!m.data.refType.ref && !(m.data.refType.type.enumerationOrPrimitive))».deepCopy()«ENDIF»));
«ENDIF»
«ENDIF»
}
- «IF m.data!=null && m.data.refType.type instanceof DataClass»
+ «IF m.data!==null && m.data.refType.type instanceof DataClass»
«messageSignatureExplicit(m)» {
«m.name»(new «m.data.refType.type.name»(«(m.data.refType.type as DataClass).paramList»));
}
@@ -286,7 +287,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
}
def generateDataDriven(Root root, ProtocolClass pc) {
- val sentMsgs = pc.allIncomingMessages.filter(m|m.data!=null)
+ val sentMsgs = pc.allIncomingMessages.filter(m|m.data!==null)
val models = root.getReferencedModels(pc)
'''
package «pc.getPackage()»;

Back to the top