Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
STS warnings
  • Loading branch information
burtbeckwith committed Aug 1, 2010
1 parent 4f9c15b commit 4f50756
Show file tree
Hide file tree
Showing 72 changed files with 314 additions and 347 deletions.
8 changes: 4 additions & 4 deletions src/java/grails/converters/JSON.java
Expand Up @@ -518,7 +518,7 @@ protected Object createNode(Object name) {
return retVal;
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
@Override
protected Object createNode(Object key, Map valueMap) {
try {
Expand All @@ -537,13 +537,13 @@ protected Object createNode(Object key, Map valueMap) {
}
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
@Override
protected Object createNode(Object arg0, Map arg1, Object arg2) {
throw new IllegalArgumentException("not implemented");
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
@Override
protected Object createNode(Object key, Object value) {
if (getCurrent() == null && stack.peek()== BuilderMode.OBJECT) {
Expand Down Expand Up @@ -572,7 +572,7 @@ protected Object createNode(Object key, Object value) {
}
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
private void handleCollectionRecurse(Collection c) throws JSONException {
writer.array();
for (Object element : c) {
Expand Down
4 changes: 2 additions & 2 deletions src/java/grails/converters/XML.java
Expand Up @@ -451,13 +451,13 @@ protected Object createNode(Object name, Object value) {
return createNode(name, null, value);
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
@Override
protected Object createNode(Object name, Map attributes) {
return createNode(name, attributes, null);
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
@Override
protected Object createNode(Object name, Map attributes, Object value) {
xml.startNode(name.toString());
Expand Down
19 changes: 9 additions & 10 deletions src/java/grails/orm/HibernateCriteriaBuilder.java
Expand Up @@ -155,14 +155,14 @@ public class HibernateCriteriaBuilder extends GroovyObjectSupport {
private boolean paginationEnabledList = false;
private List<Order> orderEntries;

@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public HibernateCriteriaBuilder(Class targetClass, SessionFactory sessionFactory) {
this.targetClass = targetClass;
targetBean = new BeanWrapperImpl(BeanUtils.instantiateClass(targetClass));
this.sessionFactory = sessionFactory;
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public HibernateCriteriaBuilder(Class targetClass, SessionFactory sessionFactory, boolean uniqueResult) {
this.targetClass = targetClass;
this.sessionFactory = sessionFactory;
Expand Down Expand Up @@ -241,7 +241,7 @@ public void distinct(String propertyName, String alias) {
*
* @param propertyNames The list of distince property names
*/
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public void distinct(Collection propertyNames) {
distinct(propertyNames, null);
}
Expand All @@ -252,7 +252,7 @@ public void distinct(Collection propertyNames) {
* @param propertyNames The list of distince property names
* @param alias The alias to use
*/
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public void distinct(Collection propertyNames, String alias) {
ProjectionList list = Projections.projectionList();
for (Object o : propertyNames) {
Expand Down Expand Up @@ -717,7 +717,7 @@ public Object eq(String propertyName, Object propertyValue) {
* @param propertyValue
* @return A Criterion instance
*/
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public Object eq(Map params, String propertyName, Object propertyValue) {
return eq(propertyName, propertyValue, params);
}
Expand All @@ -732,7 +732,7 @@ public Object eq(Map params, String propertyName, Object propertyValue) {
*
* @return A Criterion instance
*/
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public Object eq(String propertyName, Object propertyValue, Map params) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [eq] with propertyName [" +
Expand Down Expand Up @@ -831,7 +831,7 @@ public Object ilike(String propertyName, Object propertyValue) {
*
* @return A Criterion instance
*/
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public Object in(String propertyName, Collection values) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [in] with propertyName [" +
Expand All @@ -845,7 +845,7 @@ public Object in(String propertyName, Collection values) {
/**
* Delegates to in as in is a Groovy keyword
*/
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public Object inList(String propertyName, Collection values) {
return in(propertyName, values);
}
Expand Down Expand Up @@ -1076,7 +1076,7 @@ private boolean validateSimpleExpression() {
return criteria != null;
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
@Override
public Object invokeMethod(String name, Object obj) {
Object[] args = obj.getClass().isArray() ? (Object[])obj : new Object[]{obj};
Expand Down Expand Up @@ -1328,7 +1328,6 @@ private String getAssociationPath() {
return associationPath;
}

@SuppressWarnings("unchecked")
private boolean isCriteriaConstructionMethod(String name, Object[] args) {
return (name.equals(LIST_CALL) && args.length == 2 && args[0] instanceof Map && args[1] instanceof Closure) ||
(name.equals(ROOT_CALL) ||
Expand Down
2 changes: 1 addition & 1 deletion src/java/grails/orm/PagedResultList.java
Expand Up @@ -28,7 +28,7 @@
* @author Siegfried Puchbauer
* @since 1.0
*/
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public class PagedResultList implements List, Serializable {

private static final long serialVersionUID = -5820655628956173929L;
Expand Down
71 changes: 40 additions & 31 deletions src/java/grails/util/AbstractBuildSettings.java
@@ -1,12 +1,16 @@
package grails.util;

import groovy.util.ConfigObject;
import groovy.util.Eval;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;

Expand All @@ -17,11 +21,9 @@
*/
public class AbstractBuildSettings {


private static final String KEY_PLUGIN_DIRECTORY_RESOURCES = "pluginDirectoryResources";
private static final String KEY_INLINE_PLUGIN_LOCATIONS = "inlinePluginLocations";
private static final String KEY_PLUGIN_BASE_DIRECTORIES = "pluginBaseDirectories";
private static final String CONFIG_GRAILS_PLUGIN_LOCATION = "grails.plugin.location";

/**
* Used to cache results of certain expensive operations
Expand All @@ -35,16 +37,15 @@ public class AbstractBuildSettings {
/** The location where global plugins are installed to. */
protected File globalPluginsDir;


protected boolean projectPluginsDirSet;
protected boolean globalPluginsDirSet;

/**
* Flattened version of the ConfigObject for easy access from Java
*/
@SuppressWarnings("rawtypes")
protected Map flatConfig = Collections.emptyMap();


/**
* Clears any locally cached values
*/
Expand Down Expand Up @@ -83,42 +84,45 @@ public void setGlobalPluginsDir(File globalPluginsDir) {
* @param location The plugin's locatino
*/
public void addPluginDirectory(File location, boolean isInline) {
if(location != null) {
if (location != null) {
Collection<File> directories = getPluginDirectories();
if(!directories.contains(location)) {
if (!directories.contains(location)) {
directories.add(location);
if(isInline) {
if (isInline) {
getInlinePluginDirectories().add(location);
}
}
}
}

/**
* Obtains a list of plugin directories for the application
*/
* Obtains a list of plugin directories for the application
*/
@SuppressWarnings("unchecked")
public Collection<File> getPluginDirectories() {
Collection<File> pluginDirectoryResources = (Collection<File>)cache.get(KEY_PLUGIN_DIRECTORY_RESOURCES);
if (pluginDirectoryResources == null) {
pluginDirectoryResources = getImplicitPluginDirectories();
Collection<File> pluginDirectoryResources = (Collection<File>)cache.get(KEY_PLUGIN_DIRECTORY_RESOURCES);
if (pluginDirectoryResources == null) {
pluginDirectoryResources = getImplicitPluginDirectories();

// Also add any explicit plugin locations specified by the
// BuildConfig setting "grails.plugin.location.<name>"
Collection<File> inlinePlugins = getInlinePluginsFromConfiguration(config);
cache.put(KEY_INLINE_PLUGIN_LOCATIONS, inlinePlugins);
pluginDirectoryResources.addAll(inlinePlugins);
// Also add any explicit plugin locations specified by the
// BuildConfig setting "grails.plugin.location.<name>"
Collection<File> inlinePlugins = getInlinePluginsFromConfiguration(config);
cache.put(KEY_INLINE_PLUGIN_LOCATIONS, inlinePlugins);
pluginDirectoryResources.addAll(inlinePlugins);

cache.put(KEY_PLUGIN_DIRECTORY_RESOURCES, pluginDirectoryResources);
}
return pluginDirectoryResources;
}
cache.put(KEY_PLUGIN_DIRECTORY_RESOURCES, pluginDirectoryResources);
}
return pluginDirectoryResources;
}

@SuppressWarnings({ "rawtypes", "hiding" })
protected Collection<File> getInlinePluginsFromConfiguration(Map config) {
Collection<File> inlinePlugins = new ConcurrentLinkedQueue<File>();
if(config != null) {
if (config != null) {
Map pluginLocations = lookupPluginLocationConfig(config);
if (pluginLocations != null) {
for (Object value : pluginLocations.values()) {
if(value != null) {
if (value != null) {
File resource;
try {
resource = new File(value.toString()).getCanonicalFile();
Expand All @@ -134,14 +138,16 @@ protected Collection<File> getInlinePluginsFromConfiguration(Map config) {
return inlinePlugins;
}

@SuppressWarnings({ "rawtypes", "hiding" })
private Map lookupPluginLocationConfig(Map config) {
return getIfMap(getIfMap(getIfMap(config, "grails"), "plugin"), "location");
}

@SuppressWarnings({ "rawtypes", "hiding" })
private Map getIfMap(Map config, String name) {
if(config != null) {
if (config != null) {
Object o = config.get(name);
if(o instanceof Map) {
if (o instanceof Map) {
return ((Map) o);
}
}
Expand All @@ -164,7 +170,7 @@ public boolean accept(File pathname) {
return pathname.isDirectory() && (!fileName.startsWith(".") && fileName.indexOf('-') >- 1);
}
});
if(pluginDirs != null) {
if (pluginDirs != null) {
dirList.addAll(Arrays.asList(pluginDirs));
}
}
Expand All @@ -176,9 +182,10 @@ public boolean accept(File pathname) {
* Gets a list of all the known plugin base directories (directories where plugins are installed to).
* @return Returns the base location where plugins are kept
*/
@SuppressWarnings("unchecked")
public Collection<String> getPluginBaseDirectories() {
List<String> dirs = (List<String>) cache.get(KEY_PLUGIN_BASE_DIRECTORIES);
if(dirs == null) {
if (dirs == null) {
dirs = new ArrayList<String>();
if (projectPluginsDir != null) try {
dirs.add(projectPluginsDir.getCanonicalPath());
Expand All @@ -201,8 +208,9 @@ public Collection<String> getPluginBaseDirectories() {
/**
* Returns true if the specified plugin location is an inline location.
*/
@SuppressWarnings("unchecked")
public boolean isInlinePluginLocation(File pluginLocation) {
if(pluginLocation == null) return false;
if (pluginLocation == null) return false;
getPluginDirectories(); // initialize the cache
ConcurrentLinkedQueue<File> locations = (ConcurrentLinkedQueue<File>) cache.get(KEY_INLINE_PLUGIN_LOCATIONS);
return locations != null && locations.contains(pluginLocation);
Expand All @@ -211,10 +219,11 @@ public boolean isInlinePluginLocation(File pluginLocation) {
/**
* Returns an array of the inplace plugin locations.
*/
@SuppressWarnings("unchecked")
public Collection<File> getInlinePluginDirectories() {
getPluginDirectories(); // initailize the cache
Collection<File> locations = (ConcurrentLinkedQueue<File>) cache.get(KEY_INLINE_PLUGIN_LOCATIONS);
if(locations == null){
if (locations == null){
locations = new ConcurrentLinkedQueue<File>();
cache.put(KEY_INLINE_PLUGIN_LOCATIONS, locations);
}
Expand Down
2 changes: 1 addition & 1 deletion src/java/grails/util/ClosureToMapPopulator.java
Expand Up @@ -28,7 +28,7 @@
* @author Graeme Rocher
* @since 1.2
*/
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public class ClosureToMapPopulator extends GroovyObjectSupport {

private Map map;
Expand Down
2 changes: 1 addition & 1 deletion src/java/grails/util/ExtendedProxy.java
Expand Up @@ -31,7 +31,7 @@
*/
public class ExtendedProxy extends Proxy {

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
private Map propertyMap;

public ExtendedProxy() {
Expand Down
5 changes: 1 addition & 4 deletions src/java/grails/util/GrailsConfig.java
Expand Up @@ -32,27 +32,24 @@
* @author Siegfried Puchbauer
* @since 1.1
*/
@SuppressWarnings("rawtypes")
public class GrailsConfig extends GroovyObjectSupport {

private static final Log LOG = LogFactory.getLog(GrailsConfig.class);

@SuppressWarnings("unchecked")
private transient volatile static Map flatConfig;
@SuppressWarnings("unchecked")
private transient volatile static Map config;

private GrailsConfig() {
// static methods only
}

@SuppressWarnings("unchecked")
private static Map getFlatConfig() {
synchronized (GrailsConfig.class) {
return flatConfig != null ? flatConfig : (flatConfig = ConfigurationHolder.getFlatConfig());
}
}

@SuppressWarnings("unchecked")
private static Map getConfig() {
synchronized (GrailsConfig.class) {
return config != null ? config : (config = ConfigurationHolder.getConfig());
Expand Down

0 comments on commit 4f50756

Please sign in to comment.