suppress unchecked warnings

This commit is contained in:
Sebastian Sdorra
2014-01-11 15:17:44 +01:00
parent a99dfb31fc
commit 4745dd5575
49 changed files with 76 additions and 15 deletions

View File

@@ -182,6 +182,7 @@
<source>${project.build.javaLevel}</source>
<target>${project.build.javaLevel}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>

View File

@@ -205,6 +205,7 @@ public class SubCommandHandler
*
* @param line
*/
@SuppressWarnings("unchecked")
private void parseLine(String line)
{
line = line.trim();

View File

@@ -70,6 +70,7 @@ public final class GroupNames implements Serializable, Iterable<String>
* Constructs ...
*
*/
@SuppressWarnings("unchecked")
public GroupNames()
{
this.collection = Collections.EMPTY_LIST;

View File

@@ -65,6 +65,7 @@ public final class DeepCopy
*
* @throws IOException
*/
@SuppressWarnings("unchecked")
public static <T> T copy(T orig) throws IOException
{
T obj = null;

View File

@@ -76,6 +76,7 @@ public class AnnotatedClass<T extends Annotation>
* @return
*/
@Override
@SuppressWarnings("unchecked")
public boolean equals(Object obj)
{
if (obj == null)

View File

@@ -76,6 +76,7 @@ public class CacheClearHook
*
* @param predicate
*/
@SuppressWarnings("unchecked")
public void clearCache(Predicate predicate)
{
if (predicate != null)

View File

@@ -184,6 +184,7 @@ public class RepositoryManagerDecorator
* @return
*/
@Override
@SuppressWarnings("unchecked")
public RepositoryHandler getHandler(String type)
{
return decorated.getHandler(type);

View File

@@ -67,6 +67,7 @@ public class RepositoryType extends Type
* @param displayName display name of the type
* @param supportedCommands supported commands of the type
*/
@SuppressWarnings("unchecked")
public RepositoryType(String name, String displayName,
Set<Command> supportedCommands)
{

View File

@@ -202,6 +202,7 @@ public abstract class RepositoryServiceProvider implements Closeable
*
* @return
*/
@SuppressWarnings("unchecked")
public Set<Feature> getSupportedFeatures()
{
return Collections.EMPTY_SET;

View File

@@ -84,6 +84,7 @@ public final class Util
*
* @return
*/
@SuppressWarnings("unchecked")
public static <T extends Comparable> int compare(T object, T otherObject)
{
int result = 0;
@@ -268,7 +269,7 @@ public final class Util
int limit)
{
List<T> result = new ArrayList<T>();
List<T> valueList = new ArrayList(values);
List<T> valueList = new ArrayList<T>(values);
if (comparator != null)
{

View File

@@ -163,6 +163,7 @@ public class ProxyConfiguration
*
* @return
*/
@SuppressWarnings("unchecked")
public Set<String> getRequestHeaderExcludes()
{
if (requestHeaderExcludes == null)
@@ -179,6 +180,7 @@ public class ProxyConfiguration
*
* @return
*/
@SuppressWarnings("unchecked")
public Set<String> getResponseHeaderExcludes()
{
if (responseHeaderExcludes == null)

View File

@@ -203,6 +203,7 @@ public class ProxyServlet extends HttpServlet
* @param request
* @param con
*/
@SuppressWarnings("unchecked")
private void copyRequestHeaders(ProxyConfiguration configuration,
HttpServletRequest request, HttpURLConnection con)
{

View File

@@ -118,6 +118,7 @@ public class OrientDBStore<T> extends AbstractStore<T>
* @return
*/
@Override
@SuppressWarnings("unchecked")
protected T readObject()
{
T result = null;

View File

@@ -175,6 +175,7 @@ public class JAXBDataStore<T> extends FileBasedStore<T> implements DataStore<T>
* @return
*/
@Override
@SuppressWarnings("unchecked")
protected T read(File file)
{
T item = null;
@@ -203,5 +204,5 @@ public class JAXBDataStore<T> extends FileBasedStore<T> implements DataStore<T>
private JAXBContext context;
/** Field description */
private KeyGenerator keyGenerator;
private final KeyGenerator keyGenerator;
}

View File

@@ -104,12 +104,10 @@ public class JAXBStore<T> extends AbstractStore<T>
* @return
*/
@Override
@SuppressWarnings("unchecked")
protected T readObject()
{
if (logger.isDebugEnabled())
{
logger.debug("load {} from store {}", type, configFile);
}
logger.debug("load {} from store {}", type, configFile);
T result = null;
@@ -140,7 +138,7 @@ public class JAXBStore<T> extends AbstractStore<T>
if (logger.isDebugEnabled())
{
logger.debug("store {} to {}", object.getClass().getName(),
configFile.getPath());
configFile.getPath());
}
try

View File

@@ -155,6 +155,7 @@ public class SecurityModule extends ShiroWebModule
*
*/
@Override
@SuppressWarnings("unchecked")
protected void configureShiroWeb()
{
bindConstants();

View File

@@ -72,6 +72,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import sonia.scm.util.IOUtil;
/**
*
@@ -99,7 +100,6 @@ public class GitBrowseCommand extends AbstractGitCommand
*
* @param context
* @param repository
* @param repositoryDirectory
*/
public GitBrowseCommand(GitContext context, Repository repository)
{
@@ -120,6 +120,7 @@ public class GitBrowseCommand extends AbstractGitCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public BrowserResult getBrowserResult(BrowseCommandRequest request)
throws IOException, RepositoryException
{
@@ -462,6 +463,7 @@ public class GitBrowseCommand extends AbstractGitCommand
* @throws IOException
* @throws RepositoryException
*/
@SuppressWarnings("unchecked")
private Map<String,
SubRepository> getSubRepositories(org.eclipse.jgit.lib.Repository repo,
ObjectId revision)
@@ -474,10 +476,11 @@ public class GitBrowseCommand extends AbstractGitCommand
}
Map<String, SubRepository> subRepositories = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ByteArrayOutputStream baos = null;
try
{
baos = new ByteArrayOutputStream();
new GitCatCommand(context, repository).getContent(repo, revision,
PATH_MODULES, baos);
subRepositories = GitSubModuleParser.parse(baos.toString());
@@ -486,6 +489,8 @@ public class GitBrowseCommand extends AbstractGitCommand
{
logger.trace("could not find .gitmodules", ex);
subRepositories = Collections.EMPTY_MAP;
} finally {
IOUtil.close(baos);
}
return subRepositories;
@@ -494,6 +499,6 @@ public class GitBrowseCommand extends AbstractGitCommand
//~--- fields ---------------------------------------------------------------
/** Field description */
private Map<ObjectId, Map<String, SubRepository>> subrepositoryCache =
private final Map<ObjectId, Map<String, SubRepository>> subrepositoryCache =
Maps.newHashMap();
}

View File

@@ -163,6 +163,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public ChangesetPagingResult getChangesets(LogCommandRequest request)
throws IOException, RepositoryException
{

View File

@@ -296,6 +296,7 @@ public class AbstractHgHandler
* @throws IOException
* @throws RepositoryException
*/
@SuppressWarnings("unchecked")
protected <T> T getResultFromScript(Class<T> resultType,
HgPythonScript script, Map<String, String> extraEnv)
throws IOException, RepositoryException

View File

@@ -91,6 +91,7 @@ public class HgIncomingCommand extends AbstractCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public ChangesetPagingResult getIncomingChangesets(
IncomingCommandRequest request)
throws RepositoryException

View File

@@ -91,6 +91,7 @@ public class HgOutgoingCommand extends AbstractCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public ChangesetPagingResult getOutgoingChangesets(
OutgoingCommandRequest request)
throws RepositoryException

View File

@@ -86,6 +86,7 @@ public class HgPullCommand extends AbstractCommand implements PullCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public PullResponse pull(PullCommandRequest request)
throws RepositoryException, IOException
{
@@ -109,5 +110,5 @@ public class HgPullCommand extends AbstractCommand implements PullCommand
//~--- fields ---------------------------------------------------------------
/** Field description */
private HgRepositoryHandler handler;
private final HgRepositoryHandler handler;
}

View File

@@ -86,6 +86,7 @@ public class HgPushCommand extends AbstractCommand implements PushCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public PushResponse push(PushCommandRequest request)
throws RepositoryException, IOException
{
@@ -109,5 +110,5 @@ public class HgPushCommand extends AbstractCommand implements PushCommand
//~--- fields ---------------------------------------------------------------
/** Field description */
private HgRepositoryHandler handler;
private final HgRepositoryHandler handler;
}

View File

@@ -215,6 +215,7 @@ public class HgCGIServlet extends HttpServlet
* @param env
* @param session
*/
@SuppressWarnings("unchecked")
private void passSessionAttributes(EnvList env, HttpSession session)
{
Enumeration<String> enm = session.getAttributeNames();

View File

@@ -189,6 +189,7 @@ public class SvnBlameHandler implements ISVNAnnotateHandler
*
* @return
*/
@SuppressWarnings("unchecked")
private String getDescription(long revision)
{
String description = descriptionCache.get(revision);

View File

@@ -77,6 +77,7 @@ public abstract class AbstractSvnHookChangesetProvider
* @return
*/
@Override
@SuppressWarnings("unchecked")
public synchronized HookChangesetResponse handleRequest(
HookChangesetRequest request)
{

View File

@@ -106,6 +106,7 @@ public class SvnBrowseCommand extends AbstractSvnCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public BrowserResult getBrowserResult(BrowseCommandRequest request)
throws IOException, RepositoryException
{
@@ -172,6 +173,7 @@ public class SvnBrowseCommand extends AbstractSvnCommand
*
* @throws SVNException
*/
@SuppressWarnings("unchecked")
private void browseRecursive(SVNRepository svnRepository,
long revisionNumber, BrowseCommandRequest request,
List<FileObject> children, Collection<SVNDirEntry> entries, String basePath)

View File

@@ -102,6 +102,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public Changeset getChangeset(String revision)
throws IOException, RepositoryException
{
@@ -149,6 +150,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
* @throws RepositoryException
*/
@Override
@SuppressWarnings("unchecked")
public ChangesetPagingResult getChangesets(LogCommandRequest request)
throws IOException, RepositoryException
{

View File

@@ -105,6 +105,7 @@ public class SvnPostReceiveHookChangesetProvier
* @return
*/
@Override
@SuppressWarnings("unchecked")
protected Changeset fetchChangeset()
{
Changeset changeset = null;

View File

@@ -34,7 +34,6 @@ package sonia.scm.cache;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
import com.google.common.collect.Maps;
//~--- JDK imports ------------------------------------------------------------
@@ -94,5 +93,6 @@ public class MapCacheManager implements CacheManager
//~--- fields ---------------------------------------------------------------
/** Field description */
@SuppressWarnings("unchecked")
private final Map<String, Cache> cacheMap = Maps.newHashMap();
}

View File

@@ -89,6 +89,7 @@ public final class MockUtil
*
* @return
*/
@SuppressWarnings("unchecked")
public static Subject createAdminSubject()
{
Subject subject = mock(Subject.class);

View File

@@ -219,9 +219,10 @@ public class ClassOverrides implements Iterable<ClassOverride>
*
* @return
*/
@SuppressWarnings("unchecked")
public List<? extends Module> getModules()
{
List<? extends Module> modules = null;
List<? extends Module> modules;
if (Util.isNotEmpty(moduleClasses))
{
@@ -265,6 +266,7 @@ public class ClassOverrides implements Iterable<ClassOverride>
*
* @return
*/
@SuppressWarnings("unchecked")
public <T> Class<T> getOverride(Class<T> clazz)
{
Class<T> implementation = null;

View File

@@ -72,6 +72,7 @@ public class ScmSecurityModule extends ShiroWebModule
*
*/
@Override
@SuppressWarnings("unchecked")
protected void configureShiroWeb()
{

View File

@@ -538,9 +538,10 @@ public abstract class AbstractManagerResource<T extends ModelObject,
*
* @return
*/
@SuppressWarnings("unchecked")
private Comparator<T> createComparator(String sortby, boolean desc)
{
Comparator comparator = null;
Comparator comparator;
if (desc)
{

View File

@@ -355,6 +355,7 @@ public class AuthenticationResource
*
* @return
*/
@SuppressWarnings("unchecked")
private ScmState createAnonymousState()
{
return createState(SCMContext.ANONYMOUS, Collections.EMPTY_LIST,
@@ -371,6 +372,7 @@ public class AuthenticationResource
*
* @return
*/
@SuppressWarnings("unchecked")
private ScmState createState(Subject subject)
{
PrincipalCollection collection = subject.getPrincipals();

View File

@@ -135,6 +135,7 @@ public final class BootstrapUtil
*
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T loadClass(ClassLoader classLoader, Class<T> clazz)
{
T instance = null;
@@ -162,6 +163,7 @@ public final class BootstrapUtil
*
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T loadClass(ClassLoader classLoader, Class<T> clazz,
String className)
{
@@ -190,6 +192,7 @@ public final class BootstrapUtil
*
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T loadClass(Class<T> clazz, String className)
{
T instance = null;

View File

@@ -81,6 +81,7 @@ public class GuavaCache<K, V> implements Cache<K, V>
* @param configuration
* @param name
*/
@SuppressWarnings("unchecked")
public GuavaCache(GuavaCacheConfiguration configuration, String name)
{
this(GuavaCaches.create(configuration, name),

View File

@@ -125,6 +125,7 @@ public class GuavaCacheManager implements CacheManager
* @return
*/
@Override
@SuppressWarnings("unchecked")
public synchronized <K, V> GuavaCache<K, V> getCache(String name)
{
logger.trace("try to retrieve cache {}", name);

View File

@@ -79,6 +79,7 @@ public class GuavaCacheManagerConfiguration
*
* @return
*/
@SuppressWarnings("unchecked")
public List<GuavaNamedCacheConfiguration> getCaches()
{
if (caches == null)

View File

@@ -421,6 +421,7 @@ public class DefaultPluginLoader implements PluginLoader
*
* @throws MalformedURLException
*/
@SuppressWarnings("unchecked")
private void locateCoreFile() throws MalformedURLException
{
Set<String> paths = servletContext.getResourcePaths(PATH_WEBINFLIB);

View File

@@ -189,6 +189,7 @@ public class DefaultAnnotationScanner implements AnnotationScanner
* @param annotation
* @param managedClass
*/
@SuppressWarnings("unchecked")
private void processAnnotation(Class<?> annotationClass,
Annotation annotation, Class<?> managedClass)
{
@@ -317,6 +318,7 @@ public class DefaultAnnotationScanner implements AnnotationScanner
* @param extensionObjects
* @param managedClass
*/
@SuppressWarnings("unchecked")
private void processManagedClass(Class<?> managedClass)
{
logger.trace("check managed class {} for annotations", managedClass);

View File

@@ -143,6 +143,7 @@ public class ExtensionBinder
* @param extensionPointClass
* @param extensions
*/
@SuppressWarnings("unchecked")
private void bindExtensionPoint(Set<AnnotatedClass<Extension>> found,
Class extensionPointClass, Set<AnnotatedClass<Extension>> extensions)
{
@@ -169,6 +170,7 @@ public class ExtensionBinder
* @param extensionPointClass
* @param extensions
*/
@SuppressWarnings("unchecked")
private void bindMultiExtensionPoint(Set<AnnotatedClass<Extension>> found,
Class extensionPointClass, Set<AnnotatedClass<Extension>> extensions)
{
@@ -221,6 +223,7 @@ public class ExtensionBinder
* @param extensionPointClass
* @param extensionClass
*/
@SuppressWarnings("unchecked")
private void bindSingleInstance(Class extensionPointClass,
Class extensionClass)
{

View File

@@ -87,6 +87,7 @@ public class DevelopmentResourceManager extends AbstractResourceManager
* @param resourceMap
*/
@Override
@SuppressWarnings("unchecked")
protected void collectResources(Map<ResourceKey, Resource> resourceMap)
{
List<String> scripts = getScriptResources();

View File

@@ -361,6 +361,7 @@ public class DefaultSecuritySystem implements SecuritySystem
*
* @return
*/
@SuppressWarnings("unchecked")
private List<PermissionDescriptor> parsePermissionDescriptor(
JAXBContext context, URL descriptorUrl)
{
@@ -474,6 +475,7 @@ public class DefaultSecuritySystem implements SecuritySystem
*
* @return
*/
@SuppressWarnings("unchecked")
public List<PermissionDescriptor> getPermissions()
{
if (permissions == null)

View File

@@ -133,6 +133,7 @@ public class DebugServlet extends HttpServlet
*
* @param writer
*/
@SuppressWarnings("unchecked")
private void appendContextAttributes(PrintWriter writer)
{
writer.append("<h2>ServletContext Attributes</h2>");
@@ -161,6 +162,7 @@ public class DebugServlet extends HttpServlet
* @param writer
* @param session
*/
@SuppressWarnings("unchecked")
private void appendSessionAttributes(PrintWriter writer,
final HttpSession session)
{

View File

@@ -103,6 +103,7 @@ public abstract class CacheManagerTestBase<C extends Cache>
* @throws InterruptedException
*/
@Test
@SuppressWarnings("unchecked")
public void testSameReferenceMultiThreaded()
throws InterruptedException, ExecutionException
{

View File

@@ -57,6 +57,7 @@ public final class CacheTestUtil
*
* @return
*/
@SuppressWarnings("unchecked")
public static GuavaCacheManager createDefaultGuavaCacheManager()
{
GuavaCacheConfiguration config = new GuavaCacheConfiguration();

View File

@@ -52,6 +52,7 @@ public class GuavaCacheCopyTest extends CacheCopyTestBase
* @return
*/
@Override
@SuppressWarnings("unchecked")
protected Cache<String, MutableObject> createCache(CopyStrategy strategy)
{
return new GuavaCache(CacheBuilder.newBuilder().build(), strategy, "ka");

View File

@@ -378,6 +378,7 @@ public class ScmRealmTest
* @param repositories
* @return
*/
@SuppressWarnings("unchecked")
private ScmRealm createRealm(User user,
Collection<String> authenticationGroups, Collection<Group> dbGroups,
Collection<Repository> repositories)