Fixed Eclipse specific compilation error related to generics 89/38289/2
authorMichael Vorburger <vorburger@redhat.com>
Mon, 2 May 2016 16:55:58 +0000 (18:55 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 3 May 2016 08:45:52 +0000 (08:45 +0000)
until https://bugs.eclipse.org/bugs/show_bug.cgi?id=492838 is resolved

Change-Id: I910996a06341e44b2a7bc588bfa17264be0f0b08
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractDeclaredStatement.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EffectiveStatementBase.java

index 3be9aec1c6b50f4fad7bc38df0d1772fe1cabe03..eaeaaea5d6968898b59a7f539ec2df33f0e65909 100644 (file)
@@ -5,8 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
+
 package org.opendaylight.yangtools.yang.parser.spi.meta;
 
+import com.google.common.base.Function;
 import com.google.common.base.Predicates;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
@@ -15,6 +17,7 @@ import java.util.Collection;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
 
 /**
  * Utility abstract base class for implementing declared statements.
@@ -40,8 +43,9 @@ public abstract class AbstractDeclaredStatement<A> implements DeclaredStatement<
          * Perform an explicit copy, because Collections2.transform() is lazily transformed and retains pointer to
          * original collection, which may contains references to mutable context.
          */
-        substatements = ImmutableList.copyOf(Collections2.transform(context.declaredSubstatements(),
-            StmtContextUtils.buildDeclared()));
+        Collection<StatementContextBase<?, ?, ?>> declaredSubstatements = context.declaredSubstatements();
+        Function<StmtContext<?, ? extends DeclaredStatement<?>, ?>, DeclaredStatement<?>> buildDeclared = StmtContextUtils.buildDeclared();
+        substatements = ImmutableList.copyOf(Collections2.transform(declaredSubstatements, buildDeclared));
     }
 
     protected final <S extends DeclaredStatement<?>> S firstDeclared(final Class<S> type) {
index 7151db18f4c37124fc925074a37ddb331297b2cd..8b9409578116dc2bdc3bf1eae13bf2a5130dd8a7 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
+import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
@@ -91,13 +92,13 @@ public abstract class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
             this.unknownSubstatementsToBuild = ImmutableList.of();
         }
 
-        this.substatements = ImmutableList.copyOf(Collections2.transform(substatementsToBuild,
-                StmtContextUtils.buildEffective()));
+        Function<StmtContext<?, ?, ? extends EffectiveStatement<?, ?>>, EffectiveStatement<?, ?>> buildEffective = StmtContextUtils.buildEffective();
+        this.substatements = ImmutableList.copyOf(Collections2.transform(substatementsToBuild, buildEffective));
     }
 
     Collection<EffectiveStatement<?, ?>> getOmittedUnknownSubstatements() {
-        return Collections2.transform(unknownSubstatementsToBuild,
-                StmtContextUtils.buildEffective());
+        Function<StmtContext<?, ?, ? extends EffectiveStatement<?, ?>>, EffectiveStatement<?, ?>> buildEffective = StmtContextUtils.buildEffective();
+        return Collections2.transform(unknownSubstatementsToBuild, buildEffective);
     }
 
     @Override