#ignite-51: Add annotation IgniteCodeGeneratingFail.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c3416bcc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c3416bcc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c3416bcc Branch: refs/heads/ignite-user-req Commit: c3416bccb2f6db748a30a66d65eb76f6f72b28e3 Parents: 121ce6b Author: ivasilinets <ivasilin...@gridgain.com> Authored: Thu Mar 5 12:10:07 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Thu Mar 5 12:10:07 2015 +0300 ---------------------------------------------------------------------- .../ignite/codegen/MessageCodeGenerator.java | 5 ++-- .../internal/IgniteCodeGeneratingFail.java | 29 ++++++++++++++++++++ .../cache/transactions/IgniteTxEntry.java | 4 ++- 3 files changed, 35 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c3416bcc/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java ---------------------------------------------------------------------- diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java index 32ec20f..3de8326 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java @@ -18,8 +18,6 @@ package org.apache.ignite.codegen; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*; import org.apache.ignite.internal.processors.dataload.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; @@ -303,6 +301,9 @@ public class MessageCodeGenerator { private void generate(Class<? extends Message> cls) throws Exception { assert cls != null; + if (cls.isAnnotationPresent(IgniteCodeGeneratingFail.class)) + throw new IllegalStateException("@IgniteCodeGeneratingFail is provided for class: " + cls.getName()); + write.clear(); read.clear(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c3416bcc/modules/core/src/main/java/org/apache/ignite/internal/IgniteCodeGeneratingFail.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteCodeGeneratingFail.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteCodeGeneratingFail.java new file mode 100644 index 0000000..8c4ce2e --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteCodeGeneratingFail.java @@ -0,0 +1,29 @@ +/* + * 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.lang.annotation.*; + +/** + * Annotates fields that code generator should not be override. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface IgniteCodeGeneratingFail { + // No-op. +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c3416bcc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java index 323ba15..d99a8bb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java @@ -43,6 +43,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*; * {@link #equals(Object)} method, as transaction entries should use referential * equality. */ +@IgniteCodeGeneratingFail // Field filters should not be generated by MessageCodeGenerator. public class IgniteTxEntry implements GridPeerDeployAware, Message { /** */ private static final long serialVersionUID = 0L; @@ -803,7 +804,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message { writer.incrementState(); case 5: - if (!writer.writeObjectArray("filters", !F.isEmptyOrNulls(filters) ? filters : null, MessageCollectionItemType.MSG)) + if (!writer.writeObjectArray("filters", + !F.isEmptyOrNulls(filters) ? filters : null, MessageCollectionItemType.MSG)) return false; writer.incrementState();