Permalink
Browse files

Merge branch '2.1' of https://github.com/errai/errai into 2.1

  • Loading branch information...
2 parents 709b85d + 3b0317b commit b6308cf86a01a3e66e47065a313483c2c92f4134 @csadilek csadilek committed Jul 26, 2012
@@ -55,8 +55,9 @@ else if (msgQualifiers == null
// TODO: CDI 1.1 allows EventObservers to know what qualifiers were associated with firing the event
// a future version of Errai should be able to use containsAll() from the server as well, when
// Errai switches to CDI 1.1.
- || (message.hasPart(CDIProtocol.FromClient) ? msgQualifiers.containsAll(qualifierSet): msgQualifiers.equals(qualifierSet))
+ || (message.hasPart(CDIProtocol.FromClient) ? msgQualifiers.containsAll(qualifierSet) : msgQualifiers.equals(qualifierSet))
|| qualifierSet.contains(Any.class.getName())) {
+
GWT.runAsync(new RunAsyncCallback() {
public void onFailure(final Throwable throwable) {
throw new RuntimeException("failed to run asynchronously", throwable);
@@ -1,9 +1,5 @@
package org.jboss.errai.cdi.injection.client.test;
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.Set;
-
import org.jboss.errai.cdi.injection.client.AbstractBean;
import org.jboss.errai.cdi.injection.client.ApplicationScopedBean;
import org.jboss.errai.cdi.injection.client.CommonInterface;
@@ -33,6 +29,10 @@
import org.jboss.errai.ioc.client.container.IOCBeanManager;
import org.jboss.errai.ioc.client.container.IOCResolutionException;
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.Set;
+
/**
* @author Mike Brock
* @author Christian Sadilek <csadilek@redhat.com>
@@ -96,13 +96,9 @@ public static Context create(final Context parent) {
return new Context(parent);
}
- public boolean isPermissiveMode() {
- return permissiveMode;
- }
-
/**
* Add a variable to the current scope.
- *
+ *
* @param name
* the name of the variable, must not be null.
* @param type
@@ -115,7 +111,7 @@ public Context addVariable(final String name, final Class<?> type) {
/**
* Add a variable to the current scope and initialize it.
- *
+ *
* @param name
* the name of the variable, must not be null.
* @param type
@@ -131,7 +127,7 @@ public Context addVariable(final String name, final Class<?> type, final Object
/**
* Add a {@link Variable} to the current scope.
- *
+ *
* @param variable
* the variable instance to add, must not be null.
* @return the current context with the variable added.
@@ -146,7 +142,7 @@ public Context addVariable(final Variable variable) {
/**
* Add a {@link Label} to the current scope.
- *
+ *
* @param label
* the label instance to add, must not be null.
* @return the current context with the label added.
@@ -187,11 +183,11 @@ private void initImports() {
/**
* Imports the given class.
- *
+ *
* @param clazz
* the class to import, must not be null. If it is an array type (of any number of dimensions), its non-array
* component type will be imported.
- *
+ *
* @return the current context with the import added.
*/
public Context addImport(MetaClass clazz) {
@@ -213,7 +209,7 @@ public Context addImport(MetaClass clazz) {
/**
* Checks whether the given class has been imported.
- *
+ *
* @param clazz
* the class to check, must not be null.
* @return true if import exists, otherwise false.
@@ -241,7 +237,7 @@ private String getImportForClass(final MetaClass clazz) {
/**
* Returns all imports except the optional ones (java.lang.*).
- *
+ *
* @return required imports
*/
public Set<String> getRequiredImports() {
@@ -260,7 +256,7 @@ private String getImportForClass(final MetaClass clazz) {
/**
* Enables automatic import of classes used during code generation.
- *
+ *
* @return the current context whit auto import enabled.
*/
public Context autoImport() {
@@ -270,7 +266,7 @@ public Context autoImport() {
/**
* Returns a reference to the {@link Variable} with the given name.
- *
+ *
* @param name
* the name of the variable.
* @return the {@link VariableReference} found, can not be null.
@@ -283,7 +279,7 @@ public VariableReference getVariable(final String name) {
/**
* Returns a reference to the class member {@link Variable} with the given name.
- *
+ *
* @param name
* the name of the class member variable.
* @return the {@link VariableReference} found, can not be null.
@@ -320,7 +316,7 @@ private VariableReference getVariable(final String name, final boolean mustBeCla
/**
* Returns the a reference to the {@link Label} with the given name.
- *
+ *
* @param name
* the name of the label.
* @return the {@link LabelReference} found, can not be null.
@@ -346,7 +342,7 @@ public LabelReference getLabel(final String name) {
/**
* Checks is the given {@link Variable} is in scope.
- *
+ *
* @param variable
* the variable to check.
* @return true if in scope, otherwise false.
@@ -363,7 +359,7 @@ public boolean isScoped(final Variable variable) {
/**
* Checks is the given {@link MetaMethod} is in scope (part of the attached class contexts).
- *
+ *
* @param method
* the method to check.
* @return true if in scope, otherwise false.
@@ -385,7 +381,7 @@ public boolean isInScope(final MetaMethod method) {
/**
* Checks is the given {@link MetaField} is in scope (part of the attached class contexts).
- *
+ *
* @param field
* the field to check.
* @return true if in scope, otherwise false.
@@ -407,7 +403,7 @@ public boolean isInScope(final MetaField field) {
/**
* Checks if the the given variable name is ambiguous in this scope.
- *
+ *
* @param varName
* the variable name to check.
* @return true if ambiguous, otherwise false.
@@ -425,7 +421,7 @@ public boolean isAmbiguous(final String varName) {
/**
* Returns all variables in this scope (does not include variables of parent scopes).
- *
+ *
* @return collection of {@link Variable}, empty if no variables are in scope.
*/
public Collection<Variable> getDeclaredVariables() {
@@ -449,7 +445,7 @@ public void addLiteralizableMetaClasses(final Collection<MetaClass> clazzes) {
/**
* Mark a class "literalizable". Meaning that all classes that are assignable to this type, are candidates for
* reification to code snapshots for this context and all subcontexts. See {@link SnapshotMaker} for further details.
- *
+ *
* @param clazz
* the class, interface or superclass to be considered literalizable.
*/
@@ -460,7 +456,7 @@ public void addLiteralizableClass(final Class clazz) {
/**
* Mark a class "literalizable". Meaning that all classes that are assignable to this type, are candidates for
* reification to code snapshots for this context and all subcontexts. See {@link SnapshotMaker} for further details.
- *
+ *
* @param clazz
* the class, interface or superclass to be considered literalizable.
*/
@@ -470,7 +466,7 @@ public void addLiteralizableClass(final MetaClass clazz) {
/**
* Returns true if the specified class is literalizable.
- *
+ *
* @see #addLiteralizableClass(Class)
* @param clazz
* the class, interface or superclass to be tested if literalizable
@@ -482,7 +478,7 @@ public boolean isLiteralizableClass(final Class clazz) {
/**
* Returns true if the specified class is literalizable.
- *
+ *
* @see #addLiteralizableClass(MetaClass)
* @param clazz
* the class, interface or superclass to be tested if literalizable
@@ -496,7 +492,7 @@ public boolean isLiteralizableClass(final MetaClass clazz) {
* Returns the literalizable target type for any matching subtype. Meaning, that if say, the type
* <tt com.bar.FooImpl</tt> is a subtype of the interface <tt>com.bar.Foo</tt>, which is itself marked literalizable,
* this method will return a reference to the <tt>java.lang.Class</tt> instance for <tt>com.bar.Foo</tt>
- *
+ *
* @param clazz
* the class, interface or superclass to obtain a literalizable target type for.
* @return the literalizable target type that matches
@@ -511,7 +507,7 @@ public Class getLiteralizableTargetType(final Class clazz) {
* Returns the literalizable target type for any matching subtype. Meaning, that if say, the type
* <tt>com.bar.FooImpl</tt> is a subtype of the interface <tt>com.bar.Foo</tt>, which is itself marked literalizable,
* this method will return a reference to the <tt>java.lang.Class</tt> instance for <tt>com.bar.Foo</tt>
- *
+ *
* @param clazz
* the class, interface or superclass to obtain a literalizable target type for.
* @return the literalizable target type that matches
@@ -540,7 +536,7 @@ public Class getLiteralizableTargetType(final MetaClass clazz) {
/**
* Returns all variables in this scope (does not include variables of parent scopes).
- *
+ *
* @return map of variable name to {@link Variable}, empty if no variables are in scope.
*/
public Map<String, Variable> getVariables() {
@@ -552,7 +548,7 @@ public Class getLiteralizableTargetType(final MetaClass clazz) {
/**
* Attaches a class to the current scope.
- *
+ *
* @param clazz
* class to attach.
*/
@@ -562,13 +558,30 @@ public void attachClass(final MetaClass clazz) {
/**
* Checks if automatic import is active.
- *
+ *
* @return true if auto import active, otherwise false.
*/
public boolean isAutoImportActive() {
return autoImportActive;
}
+ /**
+ * Check is permissive mode is active for this context.
+ * @return
+ */
+ public boolean isPermissiveMode() {
+ return permissiveMode;
+ }
+
+ /**
+ * Sets permissive mode active for this context.
+ *
+ * @param permissiveMode
+ */
+ public void setPermissiveMode(boolean permissiveMode) {
+ this.permissiveMode = permissiveMode;
+ }
+
// TODO factor this out. should not be part of Context.
public <K, V> Map<K, V> getRenderingCache(final RenderCacheStore<K, V> store) {
Map<K, V> cacheStore = (Map<K, V>) renderingCache.get(store.getName());
View
@@ -116,7 +116,7 @@ runtime dependencies on it and it breaks deployment on JBoss AS and Tomcat -->
prevents subsequent tests from succeeding -->
<forkMode>pertest</forkMode>
- <argLine>-Xmx2048m -Dgwt.gen=/tmp/gwt_test_gen_out/ -Dgwt.args='-testBeginTimeout 5'</argLine>
+ <argLine>-Xmx2048m -Dgwt.gen=/tmp/gwt_test_gen_out/ -Dgwt.args='-testBeginTimeout 5' -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</argLine>
<systemProperties>
<property>
@@ -65,39 +65,39 @@ public static void initFromFactoryProvider(QualifierEqualityFactoryProvider prov
init();
}
- static int hashValueFor(final int i) {
+ public static int hashValueFor(final int i) {
return i;
}
- static int hashValueFor(final boolean b) {
+ public static int hashValueFor(final boolean b) {
return b ? 1 : 0;
}
- static int hashValueFor(final long l) {
+ public static int hashValueFor(final long l) {
return (int) l;
}
- static int hashValueFor(final float f) {
+ public static int hashValueFor(final float f) {
return (int) f * 1000;
}
- static int hashValueFor(final double d) {
+ public static int hashValueFor(final double d) {
return (int) d * 1000;
}
- static int hashValueFor(final char c) {
+ public static int hashValueFor(final char c) {
return (int) c;
}
- static int hashValueFor(final byte b) {
+ public static int hashValueFor(final byte b) {
return (int) b;
}
- static int hashValueFor(final short s) {
+ public static int hashValueFor(final short s) {
return (int) s;
}
- static int hashValueFor(final Object o) {
+ public static int hashValueFor(final Object o) {
if (o == null) return -1;
return o.hashCode();
}
@@ -25,7 +25,6 @@
import org.jboss.errai.codegen.meta.MetaMethod;
import org.jboss.errai.codegen.meta.impl.gwt.GWTClass;
import org.jboss.errai.codegen.util.Arith;
-import org.jboss.errai.codegen.util.GenUtil;
import org.jboss.errai.codegen.util.If;
import org.jboss.errai.codegen.util.Refs;
import org.jboss.errai.codegen.util.Stmt;
@@ -53,7 +52,7 @@
public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {
try {
// get classType and save instance variables
- GenUtil.setPermissiveMode(true);
+ // GenUtil.setPermissiveMode(true);
final JClassType classType = context.getTypeOracle().getType(typeName);
String packageName = classType.getPackage().getName();
@@ -93,6 +92,8 @@ private void generateQualifierEqualityFactory(final String packageName,
.publicScope().implementsInterface(QualifierEqualityFactory.class)
.body();
+ builder.getClassDefinition().getContext().setPermissiveMode(true);
+
final MetaClass mapStringAnnoComp
= parameterizedAs(HashMap.class, typeParametersOf(String.class, AnnotationComparator.class));
@@ -160,8 +161,6 @@ private void generateQualifierEqualityFactory(final String packageName,
printWriter.append(builder.toJavaString());
-
-
generatorContext.commit(logger, printWriter);
}

0 comments on commit b6308cf

Please sign in to comment.