This is an automated email from the ASF dual-hosted git repository.
anton-vinogradov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new f42f7daa4b3 IGNITE-29103 Generate JSON representations of the message
wire format (#13675)
f42f7daa4b3 is described below
commit f42f7daa4b3576de7684afcead35b1d0f582a0a1
Author: Aleksandr Chesnokov <[email protected]>
AuthorDate: Wed Oct 14 14:58:57 2026 +0300
IGNITE-29103 Generate JSON representations of the message wire format
(#13675)
---
.../ignite/internal/MessageCompanionGenerator.java | 13 +-
.../apache/ignite/internal/MessageGenerator.java | 35 ++++
.../ignite/internal/MessageJsonGenerator.java | 82 +++++++++
.../apache/ignite/internal/MessageProcessor.java | 21 ++-
.../ignite/internal/wire/FieldRepresentation.java | 33 ++++
.../org/apache/ignite/internal/wire/Schema.java | 31 ++++
.../apache/ignite/internal/wire/SchemaReader.java | 192 +++++++++++++++++++++
.../ignite/internal/wire/WireJsonWriter.java | 64 +++++++
.../internal/codegen/MessageProcessorTest.java | 103 +++++++++++
.../src/test/resources/codegen/ChildMessage.json | 9 +
.../resources/codegen/CorrectEmptyMessage.json | 4 +
.../codegen/CustomMapperEnumFieldsMessage.json | 7 +
.../codegen/TestCompressFieldsMessage.java | 38 ++++
.../codegen/TestCompressFieldsMessage.json | 8 +
.../test/resources/codegen/TestEnumSetMessage.json | 8 +
.../codegen/TestJdkMarshalledChildMessage.json | 12 ++
.../codegen/TestMarshalledMapMessage.json | 8 +
.../codegen/TestMarshalledObjectsMessage.json | 7 +
.../src/test/resources/codegen/TestMessage.json | 21 +++
.../codegen/TestRollingUpgradeAwareMessage.json | 10 ++
.../resources/codegen/TestTypeVariableMessage.java | 37 ++++
.../resources/codegen/TestTypeVariableMessage.json | 8 +
.../codegen/TestWildcardFieldsMessage.java | 41 +++++
.../codegen/TestWildcardFieldsMessage.json | 9 +
.../resources/codegen/TransactionIsolation.json | 8 +
parent/pom.xml | 5 +
26 files changed, 804 insertions(+), 10 deletions(-)
diff --git
a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageCompanionGenerator.java
b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageCompanionGenerator.java
index 9156694a621..7dba2d4b441 100644
---
a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageCompanionGenerator.java
+++
b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageCompanionGenerator.java
@@ -47,10 +47,10 @@ import javax.tools.StandardLocation;
import
org.apache.ignite.internal.systemview.SystemViewRowAttributeWalkerProcessor;
/**
- * Base class for message code generators ({@link MessageSerializerGenerator},
{@link MessageMarshallerGenerator},
- * {@link MessageDeploymentGenerator}).
+ * Base class for generators of Java companion classes of a message ({@link
MessageSerializerGenerator},
+ * {@link MessageMarshallerGenerator}, {@link MessageDeploymentGenerator}).
*/
-public abstract class MessageCompanionGenerator {
+public abstract class MessageCompanionGenerator implements MessageGenerator {
/** Blank separator line in generated code. */
public static final String EMPTY = "";
@@ -101,7 +101,7 @@ public abstract class MessageCompanionGenerator {
}
/** Generates and writes the source file for {@code type}; skipped when
{@link #shouldSkip} returns {@code true}. */
- protected final void generate(TypeElement type, List<VariableElement>
fields) throws Exception {
+ @Override public final void generate(TypeElement type,
List<VariableElement> fields) throws Exception {
assert this.type == null : "Message" + typeSuffix() + " generator
isn't stateless and is supposed to be single-use.";
if (shouldSkip(type, fields))
@@ -138,6 +138,11 @@ public abstract class MessageCompanionGenerator {
}
}
+ /** {@inheritDoc} */
+ @Override public String name() {
+ return typeSuffix().toLowerCase();
+ }
+
/** @return Class name suffix: {@code "Serializer"} or {@code
"Marshaller"}. */
protected abstract String typeSuffix();
diff --git
a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageGenerator.java
b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageGenerator.java
new file mode 100644
index 00000000000..9f222a5a3df
--- /dev/null
+++
b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageGenerator.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import java.util.List;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+
+/** Generates an artifact for a single message class. */
+interface MessageGenerator {
+ /**
+ * @param type Message class.
+ * @param fields Fields annotated with {@link Order} in the serialization
order.
+ * @throws Exception If generation failed.
+ */
+ void generate(TypeElement type, List<VariableElement> fields) throws
Exception;
+
+ /** @return Name of the generated artifact for diagnostics. */
+ String name();
+}
diff --git
a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageJsonGenerator.java
b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageJsonGenerator.java
new file mode 100644
index 00000000000..c0fa34d8b9a
--- /dev/null
+++
b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageJsonGenerator.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.tools.FileObject;
+import org.apache.ignite.internal.wire.Schema;
+import org.apache.ignite.internal.wire.SchemaReader;
+import org.apache.ignite.internal.wire.WireJsonWriter;
+
+import static javax.tools.StandardLocation.CLASS_OUTPUT;
+
+/** Generates JSON representations of messages and of the enums their fields
refer to. */
+public class MessageJsonGenerator implements MessageGenerator {
+ /** Directory of the representations in the class output. */
+ private static final String WIRE_DIR = "META-INF/ignite-wire/";
+
+ /** */
+ private final ProcessingEnvironment env;
+
+ /** */
+ private final SchemaReader reader;
+
+ /** */
+ private final WireJsonWriter writer = new WireJsonWriter();
+
+ /** */
+ private final Set<String> describedEnums = new HashSet<>();
+
+ /** */
+ MessageJsonGenerator(ProcessingEnvironment env) {
+ this.env = env;
+
+ reader = new SchemaReader(env);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void generate(TypeElement type, List<VariableElement>
fields) throws Exception {
+ write("messages/", reader.read(type, fields), type);
+
+ for (Schema enumSchema : reader.enums(fields)) {
+ if (describedEnums.add(enumSchema.cls()))
+ write("enums/", enumSchema, type);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String name() {
+ return "JSON representation";
+ }
+
+ /** Writes a representation to the class output. */
+ private void write(String dir, Schema schema, TypeElement src) throws
IOException {
+ FileObject file = env.getFiler().createResource(CLASS_OUTPUT, "",
WIRE_DIR + dir + schema.cls() + ".json", src);
+
+ try (Writer out = file.openWriter()) {
+ out.write(writer.write(schema));
+ }
+ }
+}
diff --git
a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageProcessor.java
b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageProcessor.java
index b5edc8553a9..ada6bc348cd 100644
---
a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageProcessor.java
+++
b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageProcessor.java
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import java.util.function.Function;
+import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
@@ -126,6 +126,9 @@ public class MessageProcessor extends AbstractProcessor {
/** */
private final Map<String, IgniteBiTuple<String, String>> enumMappersInUse
= new HashMap<>();
+ /** */
+ private MessageJsonGenerator jsonGen;
+
/** Processes all classes implementing the {@code Message} interface and
generates corresponding serializer code. */
@Override public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
TypeElement msgEl =
processingEnv.getElementUtils().getTypeElement(MESSAGE_INTERFACE);
@@ -187,19 +190,25 @@ public class MessageProcessor extends AbstractProcessor {
msgFields.put(clazz, fields);
}
- List<Function<ProcessingEnvironment, MessageCompanionGenerator>>
generators = List.of(
- MessageSerializerGenerator::new, MessageMarshallerGenerator::new,
MessageDeploymentGenerator::new);
+ if (jsonGen == null)
+ jsonGen = new MessageJsonGenerator(processingEnv);
+
+ List<Supplier<MessageGenerator>> generators = List.of(
+ () -> new MessageSerializerGenerator(processingEnv),
+ () -> new MessageMarshallerGenerator(processingEnv),
+ () -> new MessageDeploymentGenerator(processingEnv),
+ () -> jsonGen);
for (Map.Entry<TypeElement, List<VariableElement>> type:
msgFields.entrySet()) {
- for (Function<ProcessingEnvironment, MessageCompanionGenerator>
factory : generators) {
- MessageCompanionGenerator gen = factory.apply(processingEnv);
+ for (Supplier<MessageGenerator> factory : generators) {
+ MessageGenerator gen = factory.get();
try {
gen.generate(type.getKey(), type.getValue());
}
catch (Exception e) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,
- "Failed to generate a message " +
gen.typeSuffix().toLowerCase() + ":" + e.getMessage(), type.getKey());
+ "Failed to generate a message " + gen.name() + ":" +
e.getMessage(), type.getKey());
}
}
}
diff --git
a/modules/codegen/src/main/java/org/apache/ignite/internal/wire/FieldRepresentation.java
b/modules/codegen/src/main/java/org/apache/ignite/internal/wire/FieldRepresentation.java
new file mode 100644
index 00000000000..00f3a46753d
--- /dev/null
+++
b/modules/codegen/src/main/java/org/apache/ignite/internal/wire/FieldRepresentation.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.wire;
+
+import java.util.List;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Field representation.
+ *
+ * @param order Position of the field on the wire, or {@code null} for a field
without {@code @Order}.
+ * @param type Field type.
+ * @param name Field name.
+ * @param annotations Serialization annotations.
+ */
+public record FieldRepresentation(@Nullable Integer order, String type, String
name, List<String> annotations) {
+ // No-op.
+}
diff --git
a/modules/codegen/src/main/java/org/apache/ignite/internal/wire/Schema.java
b/modules/codegen/src/main/java/org/apache/ignite/internal/wire/Schema.java
new file mode 100644
index 00000000000..c5088185021
--- /dev/null
+++ b/modules/codegen/src/main/java/org/apache/ignite/internal/wire/Schema.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.wire;
+
+import java.util.List;
+
+/**
+ * Class schema.
+ *
+ * @param cls Binary name of the class.
+ * @param annotations Class serialization annotations.
+ * @param fields Fields with {@code @Order} followed by the annotated fields
without it.
+ */
+public record Schema(String cls, List<String> annotations,
List<FieldRepresentation> fields) {
+ // No-op.
+}
diff --git
a/modules/codegen/src/main/java/org/apache/ignite/internal/wire/SchemaReader.java
b/modules/codegen/src/main/java/org/apache/ignite/internal/wire/SchemaReader.java
new file mode 100644
index 00000000000..58ab232bb36
--- /dev/null
+++
b/modules/codegen/src/main/java/org/apache/ignite/internal/wire/SchemaReader.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.wire;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import java.util.stream.Collectors;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.ArrayType;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.TypeVariable;
+import javax.lang.model.type.WildcardType;
+import javax.lang.model.util.ElementFilter;
+import org.apache.ignite.internal.EmptyMessage;
+import org.apache.ignite.internal.NioField;
+import org.apache.ignite.internal.Order;
+import
org.apache.ignite.internal.systemview.SystemViewRowAttributeWalkerProcessor;
+
+/** Reads class schemas from the classes being compiled. */
+public class SchemaReader {
+ /** Package of the serialization annotations. */
+ private static final String ANNOTATIONS_PKG = Order.class.getPackageName();
+
+ /** Annotations of the package that do not affect the wire format. */
+ private static final Set<String> NOT_WIRE_ANNOTATIONS =
Set.of(NioField.class.getName(), EmptyMessage.class.getName());
+
+ /** */
+ private final ProcessingEnvironment env;
+
+ /** */
+ public SchemaReader(ProcessingEnvironment env) {
+ this.env = env;
+ }
+
+ /**
+ * @param type Class.
+ * @param fields Fields annotated with {@link Order} in the order they are
written.
+ * @return Schema of the class.
+ */
+ public Schema read(TypeElement type, List<VariableElement> fields) {
+ List<FieldRepresentation> res = new ArrayList<>();
+
+ for (VariableElement field : fields)
+ res.add(new FieldRepresentation(res.size(),
typeName(field.asType()), field.getSimpleName().toString(),
annotations(field)));
+
+ List<String> clsAnnotations = new ArrayList<>();
+ List<FieldRepresentation> unorderedFields = new ArrayList<>();
+
+ for (TypeElement cls :
SystemViewRowAttributeWalkerProcessor.superclasses(env, type).toList()) {
+ clsAnnotations.addAll(annotations(cls));
+
+ for (VariableElement field :
ElementFilter.fieldsIn(cls.getEnclosedElements())) {
+ List<String> annotations = annotations(field);
+
+ if (field.getAnnotation(Order.class) == null &&
!annotations.isEmpty()) {
+ unorderedFields.add(
+ new FieldRepresentation(null,
typeName(field.asType()), field.getSimpleName().toString(), annotations));
+ }
+ }
+ }
+
+
unorderedFields.sort(Comparator.comparing(FieldRepresentation::type).thenComparing(FieldRepresentation::name));
+
+ res.addAll(unorderedFields);
+
+ return new
Schema(env.getElementUtils().getBinaryName(type).toString(),
clsAnnotations.stream().distinct().sorted().toList(), res);
+ }
+
+ /**
+ * @param fields Fields of a class.
+ * @return Schemas of the enums the fields refer to.
+ */
+ public List<Schema> enums(List<VariableElement> fields) {
+ Set<TypeElement> enums = new HashSet<>();
+
+ for (VariableElement field : fields)
+ enums.addAll(enumTypes(field.asType()));
+
+ List<Schema> res = new ArrayList<>();
+
+ for (TypeElement enumEl : enums) {
+ String enumName =
env.getElementUtils().getBinaryName(enumEl).toString();
+
+ List<FieldRepresentation> constants = new ArrayList<>();
+
+ for (Element el : enumEl.getEnclosedElements()) {
+ if (el.getKind() == ElementKind.ENUM_CONSTANT)
+ constants.add(new FieldRepresentation(constants.size(),
enumName, el.getSimpleName().toString(), List.of()));
+ }
+
+ res.add(new Schema(enumName, List.of(), constants));
+ }
+
+ return res;
+ }
+
+ /** @return Serialization annotations of an element as the compiler prints
them. */
+ private List<String> annotations(Element el) {
+ List<String> res = new ArrayList<>();
+
+ for (AnnotationMirror ann : el.getAnnotationMirrors()) {
+ TypeElement annType =
(TypeElement)ann.getAnnotationType().asElement();
+
+ if
(!env.getElementUtils().getPackageOf(annType).getQualifiedName().contentEquals(ANNOTATIONS_PKG)
+ ||
NOT_WIRE_ANNOTATIONS.contains(annType.getQualifiedName().toString()))
+ continue;
+
+ if
(!annType.getQualifiedName().contentEquals(Order.class.getName()) ||
ann.getElementValues().size() > 1)
+ res.add(ann.toString());
+ }
+
+ Collections.sort(res);
+
+ return res;
+ }
+
+ /** @return Enums {@code type} refers to. */
+ private Set<TypeElement> enumTypes(TypeMirror type) {
+ if (type.getKind() == TypeKind.ARRAY)
+ return enumTypes(((ArrayType)type).getComponentType());
+
+ Set<TypeElement> res = new HashSet<>();
+
+ if (type.getKind() == TypeKind.DECLARED) {
+ DeclaredType declared = (DeclaredType)type;
+
+ if (declared.asElement().getKind() == ElementKind.ENUM)
+ res.add((TypeElement)declared.asElement());
+
+ for (TypeMirror arg : declared.getTypeArguments())
+ res.addAll(enumTypes(arg));
+ }
+
+ return res;
+ }
+
+ /** @return Type name. */
+ private String typeName(TypeMirror type) {
+ switch (type.getKind()) {
+ case ARRAY:
+ return typeName(((ArrayType)type).getComponentType()) + "[]";
+
+ case DECLARED:
+ DeclaredType declared = (DeclaredType)type;
+
+ String args =
declared.getTypeArguments().stream().map(this::typeName).collect(Collectors.joining(","));
+
+ return
env.getElementUtils().getBinaryName((TypeElement)declared.asElement()) +
(args.isEmpty() ? "" : '<' + args + '>');
+
+ case WILDCARD:
+ WildcardType wildcard = (WildcardType)type;
+
+ if (wildcard.getExtendsBound() != null)
+ return "? extends " + typeName(wildcard.getExtendsBound());
+
+ return wildcard.getSuperBound() == null ? "?" : "? super " +
typeName(wildcard.getSuperBound());
+
+ case TYPEVAR:
+ return ((TypeVariable)type).asElement().getSimpleName() + "
extends " + typeName(env.getTypeUtils().erasure(type));
+
+ default:
+ return type.getKind().isPrimitive() ?
type.getKind().name().toLowerCase(Locale.ROOT) : type.toString();
+ }
+ }
+}
diff --git
a/modules/codegen/src/main/java/org/apache/ignite/internal/wire/WireJsonWriter.java
b/modules/codegen/src/main/java/org/apache/ignite/internal/wire/WireJsonWriter.java
new file mode 100644
index 00000000000..913bbf75d03
--- /dev/null
+++
b/modules/codegen/src/main/java/org/apache/ignite/internal/wire/WireJsonWriter.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.wire;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/** Writes a class schema as JSON. */
+public class WireJsonWriter {
+ /** @return JSON of a schema. */
+ public String write(Schema schema) {
+ StringBuilder res = new StringBuilder("{\n \"class\":
").append(quote(schema.cls()));
+
+ if (!schema.annotations().isEmpty())
+ res.append(",\n \"annotations\":
").append(array(schema.annotations()));
+
+ List<String> fields = new ArrayList<>();
+
+ for (FieldRepresentation f : schema.fields()) {
+ List<String> members = new ArrayList<>();
+
+ if (f.order() != null)
+ members.add("\"order\": " + f.order());
+
+ members.add("\"type\": " + quote(f.type()));
+ members.add("\"name\": " + quote(f.name()));
+
+ if (!f.annotations().isEmpty())
+ members.add("\"annotations\": " + array(f.annotations()));
+
+ fields.add('{' + String.join(", ", members) + '}');
+ }
+
+ res.append(",\n \"fields\": ").append(fields.isEmpty() ? "[]" : "[\n
" + String.join(",\n ", fields) + "\n ]");
+
+ return res.append("\n}\n").toString();
+ }
+
+ /** @return JSON array of strings. */
+ private String array(List<String> vals) {
+ return vals.stream().map(this::quote).collect(Collectors.joining(", ",
"[", "]"));
+ }
+
+ /** @return JSON string. */
+ private String quote(String s) {
+ return '"' + s.replace("\\", "\\\\").replace("\"", "\\\"") + '"';
+ }
+}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/codegen/MessageProcessorTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/codegen/MessageProcessorTest.java
index 862b2d88b65..43bbb498729 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/codegen/MessageProcessorTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/codegen/MessageProcessorTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.codegen;
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URI;
@@ -48,6 +49,7 @@ import org.apache.ignite.transactions.TransactionIsolation;
import org.junit.Test;
import static com.google.testing.compile.CompilationSubject.assertThat;
+import static javax.tools.StandardLocation.CLASS_OUTPUT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -57,6 +59,9 @@ public class MessageProcessorTest {
public static final String CUSTOM_MAPPER_ERROR = "Annotation @CustomMapper
must only be used for enum fields or " +
"enum collections and maps, including nested ones.";
+ /** Directory of the representations in the class output. */
+ private static final String WIRE_DIR = "META-INF/ignite-wire/";
+
/** */
@Test
public void testMarshalledObjectsMessage() {
@@ -73,6 +78,10 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.TestMarshalledObjectsMessageMarshaller")
.hasSourceEquivalentTo(javaFile("TestMarshalledObjectsMessageMarshaller.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestMarshalledObjectsMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TestMarshalledObjectsMessage.json"));
}
/** */
@@ -91,6 +100,10 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.TestMessageMarshaller")
.hasSourceEquivalentTo(javaFile("TestMessageMarshaller.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestMessage.json")
+ .contentsAsUtf8String().isEqualTo(jsonFile("TestMessage.json"));
}
/** */
@@ -103,6 +116,10 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.TestRollingUpgradeAwareMessageSerializer")
.hasSourceEquivalentTo(javaFile("TestRollingUpgradeAwareMessageSerializer.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestRollingUpgradeAwareMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TestRollingUpgradeAwareMessage.json"));
}
/** */
@@ -163,6 +180,14 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.TestEnumSetMessageSerializer")
.hasSourceEquivalentTo(javaFile("TestEnumSetMessageSerializer.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestEnumSetMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TestEnumSetMessage.json"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"enums/org.apache.ignite.transactions.TransactionIsolation.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TransactionIsolation.json"));
}
/** */
@@ -215,6 +240,10 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.CorrectEmptyMessageSerializer")
.hasSourceEquivalentTo(javaFile("CorrectEmptyMessageSerializer.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.CorrectEmptyMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("CorrectEmptyMessage.json"));
}
/** */
@@ -254,6 +283,13 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.ChildMessageSerializer")
.hasSourceEquivalentTo(javaFile("ChildMessageSerializer.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.ChildMessage.json")
+ .contentsAsUtf8String().isEqualTo(jsonFile("ChildMessage.json"));
+
+ assertTrue(compilation
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.AbstractMessage.json").isEmpty());
}
/** */
@@ -433,6 +469,10 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.CustomMapperEnumFieldsMessageSerializer")
.hasSourceEquivalentTo(javaFile("CustomMapperEnumFieldsMessageSerializer.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.CustomMapperEnumFieldsMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("CustomMapperEnumFieldsMessage.json"));
}
/** */
@@ -512,6 +552,10 @@ public class MessageProcessorTest {
"TransactionIsolationEnumMapper.java");
assertThat(compilation).succeeded();
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"enums/org.apache.ignite.transactions.TransactionIsolation.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TransactionIsolation.json"));
}
/**
@@ -618,6 +662,10 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.TestMarshalledMapMessageMarshaller")
.hasSourceEquivalentTo(javaFile("TestMarshalledMapMessageMarshaller.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestMarshalledMapMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TestMarshalledMapMessage.json"));
}
/** Verifies array-backed Map reconstruction of {@code @Marshalled}
fields, both rebuilt and final maps. */
@@ -751,6 +799,57 @@ public class MessageProcessorTest {
assertThat(compilation).hadErrorContaining("Raw Map not supported");
}
+ /** */
+ @Test
+ public void testCompressFieldsMessage() {
+ Compilation compilation = compile("TestCompressFieldsMessage.java");
+
+ assertThat(compilation).succeeded();
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestCompressFieldsMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TestCompressFieldsMessage.json"));
+ }
+
+ /** */
+ @Test
+ public void testWildcardFieldsMessage() {
+ Compilation compilation = compile("TestWildcardFieldsMessage.java");
+
+ assertThat(compilation).succeeded();
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestWildcardFieldsMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TestWildcardFieldsMessage.json"));
+ }
+
+ /** */
+ @Test
+ public void testTypeVariableMessage() {
+ Compilation compilation = compile("TestTypeVariableMessage.java");
+
+ assertThat(compilation).succeeded();
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestTypeVariableMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TestTypeVariableMessage.json"));
+ }
+
+ /** */
+ static String jsonFile(String name) {
+ return content(javaFile(name));
+ }
+
+ /** */
+ private static String content(JavaFileObject file) {
+ try {
+ return file.getCharContent(false).toString();
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Unable to read: " + file.getName(), e);
+ }
+ }
+
/** */
private Compilation compile(String... srcFiles) {
return compile(new MessageProcessor(), srcFiles);
@@ -811,5 +910,9 @@ public class MessageProcessorTest {
assertThat(compilation)
.generatedSourceFile("org.apache.ignite.internal.TestJdkMarshalledChildMessageMarshaller")
.hasSourceEquivalentTo(javaFile("TestJdkMarshalledChildMessageMarshaller.java"));
+
+ assertThat(compilation)
+ .generatedFile(CLASS_OUTPUT, WIRE_DIR +
"messages/org.apache.ignite.internal.TestJdkMarshalledChildMessage.json")
+
.contentsAsUtf8String().isEqualTo(jsonFile("TestJdkMarshalledChildMessage.json"));
}
}
diff --git a/modules/core/src/test/resources/codegen/ChildMessage.json
b/modules/core/src/test/resources/codegen/ChildMessage.json
new file mode 100644
index 00000000000..8f2cbe019c8
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/ChildMessage.json
@@ -0,0 +1,9 @@
+{
+ "class": "org.apache.ignite.internal.ChildMessage",
+ "fields": [
+ {"order": 0, "type": "int", "name": "id"},
+ {"order": 1, "type": "byte", "name": "flags"},
+ {"order": 2, "type": "java.lang.String", "name": "str"},
+ {"order": 3, "type": "byte", "name": "flags"}
+ ]
+}
diff --git a/modules/core/src/test/resources/codegen/CorrectEmptyMessage.json
b/modules/core/src/test/resources/codegen/CorrectEmptyMessage.json
new file mode 100644
index 00000000000..623a0f0182e
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/CorrectEmptyMessage.json
@@ -0,0 +1,4 @@
+{
+ "class": "org.apache.ignite.internal.CorrectEmptyMessage",
+ "fields": []
+}
diff --git
a/modules/core/src/test/resources/codegen/CustomMapperEnumFieldsMessage.json
b/modules/core/src/test/resources/codegen/CustomMapperEnumFieldsMessage.json
new file mode 100644
index 00000000000..0810baec9be
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/CustomMapperEnumFieldsMessage.json
@@ -0,0 +1,7 @@
+{
+ "class": "org.apache.ignite.internal.CustomMapperEnumFieldsMessage",
+ "fields": [
+ {"order": 0, "type":
"org.apache.ignite.transactions.TransactionIsolation", "name": "txMode",
"annotations":
["@org.apache.ignite.internal.CustomMapper(\"org.apache.ignite.internal.TransactionIsolationEnumMapper\")"]},
+ {"order": 1, "type":
"java.util.Collection<java.util.Collection<org.apache.ignite.transactions.TransactionIsolation>>",
"name": "isolations", "annotations":
["@org.apache.ignite.internal.CustomMapper(\"org.apache.ignite.internal.TransactionIsolationEnumMapper\")"]}
+ ]
+}
diff --git
a/modules/core/src/test/resources/codegen/TestCompressFieldsMessage.java
b/modules/core/src/test/resources/codegen/TestCompressFieldsMessage.java
new file mode 100644
index 00000000000..4c5b9794ccf
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestCompressFieldsMessage.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import java.util.Map;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+public class TestCompressFieldsMessage implements Message {
+ @Order(0)
+ @Compress
+ Map<Integer, String> map;
+
+ @Order(1)
+ @Compress
+ Message nested;
+
+ @Order(2)
+ Map<Integer, String> plainMap;
+
+ public short directType() {
+ return 0;
+ }
+}
diff --git
a/modules/core/src/test/resources/codegen/TestCompressFieldsMessage.json
b/modules/core/src/test/resources/codegen/TestCompressFieldsMessage.json
new file mode 100644
index 00000000000..089153aa94f
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestCompressFieldsMessage.json
@@ -0,0 +1,8 @@
+{
+ "class": "org.apache.ignite.internal.TestCompressFieldsMessage",
+ "fields": [
+ {"order": 0, "type": "java.util.Map<java.lang.Integer,java.lang.String>",
"name": "map", "annotations": ["@org.apache.ignite.internal.Compress"]},
+ {"order": 1, "type":
"org.apache.ignite.plugin.extensions.communication.Message", "name": "nested",
"annotations": ["@org.apache.ignite.internal.Compress"]},
+ {"order": 2, "type": "java.util.Map<java.lang.Integer,java.lang.String>",
"name": "plainMap"}
+ ]
+}
diff --git a/modules/core/src/test/resources/codegen/TestEnumSetMessage.json
b/modules/core/src/test/resources/codegen/TestEnumSetMessage.json
new file mode 100644
index 00000000000..030aea431ac
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestEnumSetMessage.json
@@ -0,0 +1,8 @@
+{
+ "class": "org.apache.ignite.internal.TestEnumSetMessage",
+ "fields": [
+ {"order": 0, "type":
"java.util.EnumSet<org.apache.ignite.transactions.TransactionIsolation>",
"name": "isolations"},
+ {"order": 1, "type":
"java.util.Map<java.lang.String,java.util.EnumSet<org.apache.ignite.transactions.TransactionIsolation>>",
"name": "isolationsMap"},
+ {"order": 2, "type":
"java.util.List<java.util.EnumSet<org.apache.ignite.transactions.TransactionIsolation>>",
"name": "isolationsList"}
+ ]
+}
diff --git
a/modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessage.json
b/modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessage.json
new file mode 100644
index 00000000000..454f2c4555f
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestJdkMarshalledChildMessage.json
@@ -0,0 +1,12 @@
+{
+ "class": "org.apache.ignite.internal.TestJdkMarshalledChildMessage",
+ "annotations": ["@org.apache.ignite.internal.JdkMarshalled"],
+ "fields": [
+ {"order": 0, "type": "byte[]", "name": "dataBytes"},
+ {"order": 1, "type":
"org.apache.ignite.plugin.extensions.communication.Message", "name": "nested"},
+ {"order": 2, "type":
"org.apache.ignite.plugin.extensions.communication.Message", "name": "nioMsg"},
+ {"order": 3, "type": "byte[]", "name": "ownBytes"},
+ {"type": "java.lang.Object", "name": "data", "annotations":
["@org.apache.ignite.internal.Marshalled(\"dataBytes\")"]},
+ {"type": "java.lang.Object", "name": "own", "annotations":
["@org.apache.ignite.internal.Marshalled(\"ownBytes\")"]}
+ ]
+}
diff --git
a/modules/core/src/test/resources/codegen/TestMarshalledMapMessage.json
b/modules/core/src/test/resources/codegen/TestMarshalledMapMessage.json
new file mode 100644
index 00000000000..e15aa6b34a5
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestMarshalledMapMessage.json
@@ -0,0 +1,8 @@
+{
+ "class": "org.apache.ignite.internal.TestMarshalledMapMessage",
+ "fields": [
+ {"order": 0, "type":
"java.util.Collection<org.apache.ignite.internal.processors.cache.version.GridCacheVersion>",
"name": "mapKeys"},
+ {"order": 1, "type":
"java.util.Collection<org.apache.ignite.internal.processors.cache.version.GridCacheVersion>",
"name": "mapVals"},
+ {"type":
"java.util.Map<org.apache.ignite.internal.processors.cache.version.GridCacheVersion,org.apache.ignite.internal.processors.cache.version.GridCacheVersion>",
"name": "theMap", "annotations":
["@org.apache.ignite.internal.Marshalled(keys=\"mapKeys\",
values=\"mapVals\")"]}
+ ]
+}
diff --git
a/modules/core/src/test/resources/codegen/TestMarshalledObjectsMessage.json
b/modules/core/src/test/resources/codegen/TestMarshalledObjectsMessage.json
new file mode 100644
index 00000000000..95eb02d380b
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestMarshalledObjectsMessage.json
@@ -0,0 +1,7 @@
+{
+ "class": "org.apache.ignite.internal.TestMarshalledObjectsMessage",
+ "fields": [
+ {"order": 0, "type": "java.util.Collection<byte[]>", "name": "dataBytes"},
+ {"type": "java.util.Collection<java.lang.Object>", "name": "data",
"annotations": ["@org.apache.ignite.internal.Marshalled(\"dataBytes\")"]}
+ ]
+}
diff --git a/modules/core/src/test/resources/codegen/TestMessage.json
b/modules/core/src/test/resources/codegen/TestMessage.json
new file mode 100644
index 00000000000..2b4e348fe5c
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestMessage.json
@@ -0,0 +1,21 @@
+{
+ "class": "org.apache.ignite.internal.TestMessage",
+ "fields": [
+ {"order": 0, "type": "int", "name": "id"},
+ {"order": 1, "type": "byte[]", "name": "byteArr"},
+ {"order": 2, "type": "java.lang.String", "name": "str"},
+ {"order": 3, "type": "java.lang.String[]", "name": "strArr"},
+ {"order": 4, "type": "int[][]", "name": "intMatrix"},
+ {"order": 5, "type":
"org.apache.ignite.internal.processors.cache.version.GridCacheVersion", "name":
"ver"},
+ {"order": 6, "type":
"org.apache.ignite.internal.processors.cache.version.GridCacheVersion[]",
"name": "verArr"},
+ {"order": 7, "type": "java.util.UUID", "name": "uuid"},
+ {"order": 8, "type": "org.apache.ignite.lang.IgniteUuid", "name":
"ignUuid"},
+ {"order": 9, "type":
"org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion",
"name": "topVer"},
+ {"order": 10, "type": "java.util.BitSet", "name": "bitSet"},
+ {"order": 11, "type": "java.lang.String", "name": "field"},
+ {"order": 12, "type":
"org.apache.ignite.internal.processors.cache.KeyCacheObject", "name":
"keyCacheObject"},
+ {"order": 13, "type":
"org.apache.ignite.internal.processors.cache.CacheObject", "name":
"cacheObject"},
+ {"order": 14, "type": "org.apache.ignite.internal.util.GridLongList",
"name": "gridLongList"},
+ {"order": 15, "type": "org.apache.ignite.internal.GridTopicMessage",
"name": "nioMsg"}
+ ]
+}
diff --git
a/modules/core/src/test/resources/codegen/TestRollingUpgradeAwareMessage.json
b/modules/core/src/test/resources/codegen/TestRollingUpgradeAwareMessage.json
new file mode 100644
index 00000000000..a1a8fd4e412
--- /dev/null
+++
b/modules/core/src/test/resources/codegen/TestRollingUpgradeAwareMessage.json
@@ -0,0 +1,10 @@
+{
+ "class": "org.apache.ignite.internal.TestRollingUpgradeAwareMessage",
+ "annotations":
["@org.apache.ignite.internal.FeatureGated(registry=org.apache.ignite.internal.TestFeatureRegistry.class)"],
+ "fields": [
+ {"order": 0, "type": "int", "name": "plain"},
+ {"order": 1, "type": "java.lang.String", "name": "oldFld", "annotations":
["@org.apache.ignite.internal.Order(value=1, deprecatedBy=\"FIRST_FEATURE\")"]},
+ {"order": 2, "type": "java.lang.String", "name": "newFld", "annotations":
["@org.apache.ignite.internal.Order(value=2, introducedBy=\"FIRST_FEATURE\")"]},
+ {"order": 3, "type": "long", "name": "windowed", "annotations":
["@org.apache.ignite.internal.Order(value=3, introducedBy=\"FIRST_FEATURE\",
deprecatedBy=\"SECOND_FEATURE\")"]}
+ ]
+}
diff --git
a/modules/core/src/test/resources/codegen/TestTypeVariableMessage.java
b/modules/core/src/test/resources/codegen/TestTypeVariableMessage.java
new file mode 100644
index 00000000000..499575ebd04
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestTypeVariableMessage.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+public class TestTypeVariableMessage<R extends Message, T extends
Comparable<T>> implements Message {
+ @Order(0)
+ Map<UUID, R> res;
+
+ @Marshalled("valBytes")
+ T val;
+
+ @Order(1)
+ byte[] valBytes;
+
+ public short directType() {
+ return 0;
+ }
+}
diff --git
a/modules/core/src/test/resources/codegen/TestTypeVariableMessage.json
b/modules/core/src/test/resources/codegen/TestTypeVariableMessage.json
new file mode 100644
index 00000000000..84606346a53
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestTypeVariableMessage.json
@@ -0,0 +1,8 @@
+{
+ "class": "org.apache.ignite.internal.TestTypeVariableMessage",
+ "fields": [
+ {"order": 0, "type": "java.util.Map<java.util.UUID,R extends
org.apache.ignite.plugin.extensions.communication.Message>", "name": "res"},
+ {"order": 1, "type": "byte[]", "name": "valBytes"},
+ {"type": "T extends java.lang.Comparable", "name": "val", "annotations":
["@org.apache.ignite.internal.Marshalled(\"valBytes\")"]}
+ ]
+}
diff --git
a/modules/core/src/test/resources/codegen/TestWildcardFieldsMessage.java
b/modules/core/src/test/resources/codegen/TestWildcardFieldsMessage.java
new file mode 100644
index 00000000000..d37378b6b59
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestWildcardFieldsMessage.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.Map;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+public class TestWildcardFieldsMessage implements Message {
+ @Marshalled("entryBytes")
+ Map.Entry<?, ? extends Serializable> entry;
+
+ @Order(0)
+ byte[] entryBytes;
+
+ @Marshalled("sorterBytes")
+ Comparator<? super String> sorter;
+
+ @Order(1)
+ byte[] sorterBytes;
+
+ public short directType() {
+ return 0;
+ }
+}
diff --git
a/modules/core/src/test/resources/codegen/TestWildcardFieldsMessage.json
b/modules/core/src/test/resources/codegen/TestWildcardFieldsMessage.json
new file mode 100644
index 00000000000..4716b370d46
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TestWildcardFieldsMessage.json
@@ -0,0 +1,9 @@
+{
+ "class": "org.apache.ignite.internal.TestWildcardFieldsMessage",
+ "fields": [
+ {"order": 0, "type": "byte[]", "name": "entryBytes"},
+ {"order": 1, "type": "byte[]", "name": "sorterBytes"},
+ {"type": "java.util.Comparator<? super java.lang.String>", "name":
"sorter", "annotations":
["@org.apache.ignite.internal.Marshalled(\"sorterBytes\")"]},
+ {"type": "java.util.Map$Entry<?,? extends java.io.Serializable>", "name":
"entry", "annotations":
["@org.apache.ignite.internal.Marshalled(\"entryBytes\")"]}
+ ]
+}
diff --git a/modules/core/src/test/resources/codegen/TransactionIsolation.json
b/modules/core/src/test/resources/codegen/TransactionIsolation.json
new file mode 100644
index 00000000000..e657a9293f5
--- /dev/null
+++ b/modules/core/src/test/resources/codegen/TransactionIsolation.json
@@ -0,0 +1,8 @@
+{
+ "class": "org.apache.ignite.transactions.TransactionIsolation",
+ "fields": [
+ {"order": 0, "type":
"org.apache.ignite.transactions.TransactionIsolation", "name":
"READ_COMMITTED"},
+ {"order": 1, "type":
"org.apache.ignite.transactions.TransactionIsolation", "name":
"REPEATABLE_READ"},
+ {"order": 2, "type":
"org.apache.ignite.transactions.TransactionIsolation", "name": "SERIALIZABLE"}
+ ]
+}
diff --git a/parent/pom.xml b/parent/pom.xml
index 22d88a04b40..b3405e38184 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -279,6 +279,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.jar.plugin.version}</version>
+ <configuration>
+ <excludes>
+ <exclude>META-INF/ignite-wire/**</exclude>
+ </excludes>
+ </configuration>
</plugin>
<plugin>