Permalink
Browse files

cleanup, STS warnings

  • Loading branch information...
1 parent 0008b96 commit 17b252e2f5c5cd2f3b8f97ebe13df32783713f89 Burt Beckwith committed Sep 29, 2012
Showing with 347 additions and 390 deletions.
  1. +2 −5 grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/support/GrailsRootLoader.java
  2. +14 −13 ...rap/src/main/groovy/org/codehaus/groovy/grails/resolve/config/AbstractDependenciesConfigurer.java
  3. +3 −3 ...ootstrap/src/main/groovy/org/codehaus/groovy/grails/resolve/config/JarDependenciesConfigurer.java
  4. +54 −51 ...bootstrap/src/main/groovy/org/codehaus/groovy/grails/resolve/config/RepositoriesConfigurer.groovy
  5. +9 −8 grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/ControllerArtefactHandler.java
  6. +0 −1 grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsApplication.java
  7. +8 −18 ...s-core/src/main/groovy/org/codehaus/groovy/grails/commons/spring/GrailsWebApplicationContext.java
  8. +6 −19 grails-core/src/main/groovy/org/codehaus/groovy/grails/compiler/GrailsProjectWatcher.java
  9. +23 −36 ...ls-core/src/main/groovy/org/codehaus/groovy/grails/project/packaging/GrailsProjectPackager.groovy
  10. +3 −3 ...s-hibernate/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/HibernateGormEnhancer.groovy
  11. +0 −1 ...s-hibernate/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/cfg/GrailsHibernateUtil.java
  12. +0 −3 grails-hibernate/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/cfg/PropertyConfig.groovy
  13. +2 −0 ...in-gsp/src/ast/groovy/org/codehaus/groovy/grails/compiler/web/gsp/GroovyPageOptimizerVisitor.java
  14. +5 −5 grails-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/RenderTagLib.groovy
  15. +3 −4 ...-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/ValidationTagLib.groovy
  16. +7 −7 grails-plugin-testing/src/main/groovy/grails/test/mixin/support/GrailsUnitTestMixin.groovy
  17. +44 −43 grails-plugin-testing/src/main/groovy/grails/test/mixin/web/ControllerUnitTestMixin.groovy
  18. +17 −18 ...plugin-url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/DefaultUrlCreator.java
  19. +3 −3 ...l-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/DefaultUrlMappingEvaluator.java
  20. +5 −4 ...in-url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/DefaultUrlMappingInfo.java
  21. +5 −5 ...url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/DefaultUrlMappingsHolder.java
  22. +23 −16 ...s-plugin-url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/RegexUrlMapping.java
  23. +4 −4 ...n-url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/ResponseCodeUrlMapping.java
  24. +2 −2 ...url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/filter/UrlMappingsFilter.java
  25. +10 −10 ...st-suite-persistence/src/test/groovy/org/codehaus/groovy/grails/orm/hibernate/CustomIdSpec.groovy
  26. +26 −26 ...ersistence/src/test/groovy/org/codehaus/groovy/grails/orm/hibernate/FirstAndLastMethodSpec.groovy
  27. +3 −5 grails-test-suite-uber/src/test/groovy/grails/spring/BeanBuilderTests.groovy
  28. +6 −6 grails-test-suite-web/src/test/groovy/grails/test/GrailsUrlMappingsTestCaseTests.groovy
  29. +0 −1 ...te-web/src/test/groovy/org/codehaus/groovy/grails/web/pages/GroovyPagesTemplateEngineTests.groovy
  30. +14 −16 ...t-suite-web/src/test/groovy/org/codehaus/groovy/grails/web/taglib/LinkRenderingTagLibTests.groovy
  31. +4 −4 grails-test-suite-web/src/test/groovy/org/codehaus/groovy/grails/web/taglib/RenderTagLibTests.groovy
  32. +4 −4 ...test-suite-web/src/test/groovy/org/codehaus/groovy/grails/web/taglib/ValidationTagLibTests.groovy
  33. +1 −1 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/mapping/AbstractUrlMapping.java
  34. +4 −4 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/mapping/UrlCreator.java
  35. +1 −1 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/mapping/UrlMapping.java
  36. +1 −1 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/mapping/UrlMappingInfo.java
  37. +2 −2 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/mapping/UrlMappingsHolder.java
  38. +2 −2 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/pages/GroovyPage.java
  39. +6 −7 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/pages/GroovyPageWritable.java
  40. +7 −8 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/taglib/GroovyPageAttributes.java
  41. +14 −20 scripts/_GrailsRun.groovy
@@ -29,7 +29,6 @@
*/
public class GrailsRootLoader extends RootLoader {
-
public GrailsRootLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
}
@@ -41,12 +40,10 @@ public GrailsRootLoader() {
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
try {
- if(name.startsWith("java.") || name.startsWith("javax.xml.") || name.startsWith("org.w3c.dom.")) {
+ if (name.startsWith("java.") || name.startsWith("javax.xml.") || name.startsWith("org.w3c.dom.")) {
return getParent().loadClass(name);
}
- else {
- return super.loadClass(name, resolve);
- }
+ return super.loadClass(name, resolve);
}
catch (LinkageError e) {
return getParent().loadClass(name);
@@ -48,26 +48,27 @@ public Object invokeMethod(String name, Object args) {
}
List<Object> argsList = Arrays.asList((Object[])args);
- if (argsList.size() == 0) {
+ if (argsList.isEmpty()) {
GrailsConsole.getInstance().error("WARNING: Configurational method [" + name + "] in grails-app/conf/BuildConfig.groovy doesn't exist. Ignoring..");
return null;
}
if (isOnlyStrings(argsList)) {
addDependencyStrings(name, argsList, null, null);
-
- } else if (isProperties(argsList)) {
+ }
+ else if (isProperties(argsList)) {
addDependencyMaps(name, argsList, null);
-
- } else if (isStringsAndConfigurer(argsList)) {
+ }
+ else if (isStringsAndConfigurer(argsList)) {
addDependencyStrings(name, argsList.subList(0, argsList.size() - 1), null, (Closure<?>)argsList.get(argsList.size() - 1));
-
- } else if (isPropertiesAndConfigurer(argsList)) {
+ }
+ else if (isPropertiesAndConfigurer(argsList)) {
addDependencyMaps(name, argsList.subList(0, argsList.size() - 1), (Closure<?>)argsList.get(argsList.size() - 1));
- } else if (isStringsAndProperties(argsList)) {
+ }
+ else if (isStringsAndProperties(argsList)) {
addDependencyStrings(name, argsList.subList(0, argsList.size() - 1), (Map<Object, Object>)argsList.get(argsList.size() - 1), null);
-
- } else {
+ }
+ else {
GrailsConsole.getInstance().error("WARNING: Configurational method [" + name + "] in grails-app/conf/BuildConfig.groovy doesn't exist. Ignoring..");
}
@@ -168,9 +169,9 @@ private void addDependency(String scope, Map<Object, Object> dependency, Closure
boolean transitive = getBooleanValueOrDefault(dependency, "transitive", true);
Boolean export = getExportSetting(dependency);
- boolean isExcluded = context.pluginName != null ?
- context.dependencyManager.isExcludedFromPlugin(context.pluginName, name) :
- context.dependencyManager.isExcluded(name);
+ boolean isExcluded = context.pluginName == null ?
+ context.dependencyManager.isExcluded(name) :
+ context.dependencyManager.isExcludedFromPlugin(context.pluginName, name);
if (isExcluded) {
return;
@@ -33,11 +33,11 @@ protected void addDependency(String scope, EnhancedDefaultDependencyDescriptor d
@Override
protected void handleExport(EnhancedDefaultDependencyDescriptor descriptor, Boolean export) {
- if (export != null) {
- descriptor.setExported(export);
+ if (export == null) {
+ descriptor.setExport(true);
}
else {
- descriptor.setExport(true);
+ descriptor.setExported(export);
}
}
@@ -14,6 +14,10 @@
*/
package org.codehaus.groovy.grails.resolve.config
+import groovy.transform.CompileStatic
+import groovy.transform.TypeCheckingMode
+import groovy.util.slurpersupport.GPathResult
+
import org.apache.ivy.plugins.latest.LatestTimeStrategy
import org.apache.ivy.plugins.resolver.DependencyResolver
import org.apache.ivy.plugins.resolver.FileSystemResolver
@@ -23,10 +27,6 @@ import org.apache.ivy.util.Message
import org.codehaus.groovy.grails.resolve.GrailsPluginsDirectoryResolver
import org.codehaus.groovy.grails.resolve.GrailsRepoResolver
import org.codehaus.groovy.grails.resolve.SnapshotAwareM2Resolver
-import groovy.transform.CompileStatic
-import groovy.transform.TypeCheckingMode
-import groovy.util.slurpersupport.GPathResult
-
class RepositoriesConfigurer extends AbstractDependencyManagementConfigurer {
@@ -48,36 +48,36 @@ class RepositoriesConfigurer extends AbstractDependencyManagementConfigurer {
void flatDir(Map args) {
def name = args.get('name')?.toString()
def dirsO = args.get('dirs')
- if (name && dirsO) {
- def fileSystemResolver = new FileSystemResolver()
- fileSystemResolver.local = true
- fileSystemResolver.name = name
-
- Collection dirs = (Collection)(args.get('dirs') instanceof Collection ? args.get('dirs'): [args.get('dirs')])
-
- dependencyManager.repositoryData << ['type':'flatDir', name:name, dirs:dirs.join(',')]
- dirs.each { dir ->
- def path = new File(dir?.toString()).absolutePath
- fileSystemResolver.addIvyPattern("${path}/[module]-[revision](-[classifier]).xml")
- fileSystemResolver.addArtifactPattern "${path}/[module]-[revision](-[classifier]).[ext]"
- }
- fileSystemResolver.settings = dependencyManager.ivySettings
+ if (!name || !dirsO) {
+ return
+ }
+
+ def fileSystemResolver = new FileSystemResolver()
+ fileSystemResolver.local = true
+ fileSystemResolver.name = name
- addToChainResolver(fileSystemResolver)
+ Collection dirs = (Collection)(args.get('dirs') instanceof Collection ? args.get('dirs'): [args.get('dirs')])
+
+ dependencyManager.repositoryData << [type: 'flatDir', name:name, dirs:dirs.join(',')]
+ dirs.each { dir ->
+ def path = new File(dir?.toString()).absolutePath
+ fileSystemResolver.addIvyPattern("${path}/[module]-[revision](-[classifier]).xml")
+ fileSystemResolver.addArtifactPattern "${path}/[module]-[revision](-[classifier]).[ext]"
}
- }
+ fileSystemResolver.settings = dependencyManager.ivySettings
+ addToChainResolver(fileSystemResolver)
+ }
@CompileStatic
void grailsPlugins() {
- if (!context.offline) {
- if (isResolverNotAlreadyDefined('grailsPlugins')) {
- dependencyManager.repositoryData << [type: 'grailsPlugins', name:"grailsPlugins"]
- if (dependencyManager.buildSettings != null) {
- def pluginResolver = new GrailsPluginsDirectoryResolver(dependencyManager.buildSettings, dependencyManager.ivySettings)
- addToChainResolver(pluginResolver)
- }
- }
+ if (context.offline || !isResolverNotAlreadyDefined('grailsPlugins')) {
+ return
+ }
+
+ dependencyManager.repositoryData << [type: 'grailsPlugins', name:"grailsPlugins"]
+ if (dependencyManager.buildSettings != null) {
+ addToChainResolver new GrailsPluginsDirectoryResolver(dependencyManager.buildSettings, dependencyManager.ivySettings)
}
}
@@ -117,25 +117,26 @@ class RepositoriesConfigurer extends AbstractDependencyManagementConfigurer {
@CompileStatic
void mavenRepo(String url) {
- if (!context.offline && isResolverNotAlreadyDefined(url) ) {
- dependencyManager.repositoryData << ['type':'mavenRepo', root:url, name:url, m2compatbile:true]
- def resolver = new SnapshotAwareM2Resolver()
- resolver.name = url
- resolver.root = url
- resolver.m2compatible = true
- resolver.settings = dependencyManager.ivySettings
- resolver.changingPattern = ".*SNAPSHOT"
- addToChainResolver(resolver)
+ if (context.offline || !isResolverNotAlreadyDefined(url)) {
+ return
}
- }
+ dependencyManager.repositoryData << [type: 'mavenRepo', root: url, name: url, m2compatbile: true]
+ def resolver = new SnapshotAwareM2Resolver()
+ resolver.name = url
+ resolver.root = url
+ resolver.m2compatible = true
+ resolver.settings = dependencyManager.ivySettings
+ resolver.changingPattern = ".*SNAPSHOT"
+ addToChainResolver(resolver)
+ }
@CompileStatic
void mavenRepo(Map args) {
def name = args?.get('name')
if (args && name) {
if (!context.offline && isResolverNotAlreadyDefined(name?.toString())) {
- dependencyManager.repositoryData << (['type':'mavenRepo'] + args)
+ dependencyManager.repositoryData << ([type: 'mavenRepo'] + args)
args.settings = dependencyManager.ivySettings
def resolver = createSnapshotResolver(args)
@@ -163,17 +164,19 @@ class RepositoriesConfigurer extends AbstractDependencyManagementConfigurer {
@CompileStatic
void ebr() {
if (!context.offline && isResolverNotAlreadyDefined('ebr')) {
- dependencyManager.repositoryData << ['type':'ebr']
- IBiblioResolver ebrReleaseResolver = createSnapshotResolver(name:"ebrRelease",
- root:"http://repository.springsource.com/maven/bundles/release",
- m2compatible:true,
- settings:dependencyManager.ivySettings)
+ dependencyManager.repositoryData << [type: 'ebr']
+ IBiblioResolver ebrReleaseResolver = createSnapshotResolver(
+ name:"ebrRelease",
+ root:"http://repository.springsource.com/maven/bundles/release",
+ m2compatible:true,
+ settings:dependencyManager.ivySettings)
addToChainResolver(ebrReleaseResolver)
- IBiblioResolver ebrExternalResolver = createSnapshotResolver(name:"ebrExternal",
- root:"http://repository.springsource.com/maven/bundles/external",
- m2compatible:true,
- settings:dependencyManager.ivySettings)
+ IBiblioResolver ebrExternalResolver = createSnapshotResolver(
+ name:"ebrExternal",
+ root:"http://repository.springsource.com/maven/bundles/external",
+ m2compatible:true,
+ settings:dependencyManager.ivySettings)
addToChainResolver(ebrExternalResolver)
}
@@ -189,7 +192,7 @@ class RepositoriesConfigurer extends AbstractDependencyManagementConfigurer {
@CompileStatic
void grailsRepo(String url, String name=null) {
if (!context.offline && isResolverNotAlreadyDefined(name ?: url)) {
- dependencyManager.repositoryData << ['type':'grailsRepo', url:url]
+ dependencyManager.repositoryData << [type: 'grailsRepo', url:url]
def urlResolver = new GrailsRepoResolver(name ?: url, new URL(url))
urlResolver.addArtifactPattern("${url}/grails-[module]/tags/RELEASE_*/grails-[module]-[revision].[ext]")
urlResolver.addIvyPattern("${url}/grails-[module]/tags/RELEASE_*/[module]-[revision].pom")
@@ -211,7 +214,7 @@ class RepositoriesConfigurer extends AbstractDependencyManagementConfigurer {
@CompileStatic
void mavenCentral() {
if (!context.offline && isResolverNotAlreadyDefined('mavenCentral')) {
- dependencyManager.repositoryData << ['type':'mavenCentral']
+ dependencyManager.repositoryData << [type: 'mavenCentral']
IBiblioResolver mavenResolver = createSnapshotResolver(name:"mavenCentral")
mavenResolver.m2compatible = true
mavenResolver.settings = dependencyManager.ivySettings
@@ -223,7 +226,7 @@ class RepositoriesConfigurer extends AbstractDependencyManagementConfigurer {
@CompileStatic
void mavenLocal(String repoPath = null) {
if (isResolverNotAlreadyDefined('mavenLocal')) {
- dependencyManager.repositoryData << ['type':'mavenLocal']
+ dependencyManager.repositoryData << [type: 'mavenLocal']
FileSystemResolver localMavenResolver = new FileSystemResolver()
localMavenResolver.name = 'localMavenResolver'
localMavenResolver.local = true
@@ -72,16 +72,17 @@ public String getPluginName() {
return PLUGIN_NAME;
}
+ @SuppressWarnings("rawtypes")
@Override
public GrailsClass getArtefactForFeature(Object featureId) {
if (artefactInfo == null) {
return null;
}
-
- String uri = null;
+
+ String uri;
String pluginName = null;
- if(featureId instanceof Map) {
+ if (featureId instanceof Map) {
Map featureIdMap = (Map)featureId;
uri = (String)featureIdMap.get("uri");
pluginName = (String)featureIdMap.get("pluginName");
@@ -93,9 +94,9 @@ public GrailsClass getArtefactForFeature(Object featureId) {
if (controllerClass == null) {
final ApplicationContext mainContext = grailsApplication.getMainContext();
GrailsPluginManager grailsPluginManager = null;
- if(mainContext.containsBean(GrailsPluginManager.BEAN_NAME)) {
+ if (mainContext.containsBean(GrailsPluginManager.BEAN_NAME)) {
final Object pluginManagerBean = mainContext.getBean(GrailsPluginManager.BEAN_NAME);
- if(pluginManagerBean instanceof GrailsPluginManager) {
+ if (pluginManagerBean instanceof GrailsPluginManager) {
grailsPluginManager = (GrailsPluginManager) pluginManagerBean;
}
}
@@ -105,15 +106,15 @@ public GrailsClass getArtefactForFeature(Object featureId) {
GrailsClass c = controllerClasses[i];
if (((GrailsControllerClass) c).mapsToURI(uri)) {
boolean foundController = false;
- if(pluginName != null && grailsPluginManager != null) {
+ if (pluginName != null && grailsPluginManager != null) {
final GrailsPlugin pluginForClass = grailsPluginManager.getPluginForClass(c.getClazz());
- if(pluginForClass != null && pluginName.equals(pluginForClass.getName())) {
+ if (pluginForClass != null && pluginName.equals(pluginForClass.getName())) {
foundController = true;
}
} else {
foundController = true;
}
- if(foundController) {
+ if (foundController) {
controllerClass = c;
break;
}
@@ -23,7 +23,6 @@
import groovy.util.ConfigObject;
import java.io.IOException;
-import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -74,22 +74,16 @@ public GrailsWebApplicationContext(DefaultListableBeanFactory defaultListableBea
@Override
public ClassLoader getClassLoader() {
GrailsApplication application = getGrailsApplication();
-
- if (application != null) {
- return application.getClassLoader();
- }
-
- return super.getClassLoader();
+ return application == null ? super.getClassLoader() : application.getClassLoader();
}
-
+
private GrailsApplication getGrailsApplication() {
ApplicationContext parent = getParent();
- GrailsApplication application = null;
- if (parent != null && parent.containsBean(GrailsApplication.APPLICATION_ID)) {
- application = (GrailsApplication) parent.getBean(GrailsApplication.APPLICATION_ID);
-
+ if (parent == null || !parent.containsBean(GrailsApplication.APPLICATION_ID)) {
+ return null;
}
- return application;
+
+ return (GrailsApplication)parent.getBean(GrailsApplication.APPLICATION_ID);
}
/**
@@ -183,18 +177,14 @@ public ServletConfig getServletConfig() {
@Override
protected ConfigurableEnvironment createEnvironment() {
GrailsApplication grailsApplication = getGrailsApplication();
- if (grailsApplication != null) {
- return new GrailsEnvironment(grailsApplication);
- }
- return new StandardServletEnvironment();
+ return grailsApplication == null ? new StandardServletEnvironment() : new GrailsEnvironment(grailsApplication);
}
@Override
public ConfigurableWebEnvironment getEnvironment() {
ConfigurableEnvironment env = super.getEnvironment();
Assert.isInstanceOf(ConfigurableWebEnvironment.class, env,
- "ConfigurableWebApplication environment must be of type " +
- "ConfigurableWebEnvironment");
+ "ConfigurableWebApplication environment must be of type ConfigurableWebEnvironment");
return (ConfigurableWebEnvironment) env;
}
}
Oops, something went wrong.

0 comments on commit 17b252e

Please sign in to comment.