fix compilation warnings

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/pom.xml b/pom.xml
index 3a3e947..03c79f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -117,6 +117,7 @@
                     <!-- source>1.6</source -->
                     <!-- target>1.6</target -->
                     <!-- compilerArgument>-nowarn</compilerArgument> <disable all warnings -->
+                    <!--<compilerArgument>-warn:+deprecation,allJavadoc</compilerArgument>-->
                     <!-- compilerArgument>-warn:[+|-]warning_tokens_separated_by_comma - Specify the set of enabled warnings </compilerArgument -->
                     <!-- compilerArgument>-err:warning_tokens_separated_by_comma - convert exactly the listed warnings to errors  </compilerArgument -->
                     <!-- compilerArgument>-err:+warning_tokens_separated_by_comma - convert additional warnings to errors</compilerArgument -->
diff --git a/src/javax/persistence/ParameterMode.java b/src/javax/persistence/ParameterMode.java
index 1c5b9e0..4c965fa 100644
--- a/src/javax/persistence/ParameterMode.java
+++ b/src/javax/persistence/ParameterMode.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
+ * Copyright (c) 2011 - 2017 Oracle Corporation. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
@@ -14,10 +14,6 @@
  ******************************************************************************/ 
 package javax.persistence; 
 
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
 /**
  * Specifies the mode of a parameter of a stored procedure query.
  *
diff --git a/src/javax/persistence/spi/PersistenceProviderResolverHolder.java b/src/javax/persistence/spi/PersistenceProviderResolverHolder.java
index daf9db9..6fc66eb 100644
--- a/src/javax/persistence/spi/PersistenceProviderResolverHolder.java
+++ b/src/javax/persistence/spi/PersistenceProviderResolverHolder.java
@@ -19,6 +19,8 @@
 import java.lang.ref.ReferenceQueue;

 import java.lang.ref.SoftReference;

 import java.lang.ref.WeakReference;

+import java.security.AccessController;

+import java.security.PrivilegedAction;

 import java.util.ArrayList;

 import java.util.List;

 import java.util.HashMap;

@@ -146,15 +148,12 @@
         private static ClassLoader getContextClassLoader() {

             if (System.getSecurityManager() == null) {

                 return Thread.currentThread().getContextClassLoader();

-            }

-            else {

-                return  (ClassLoader) java.security.AccessController.doPrivileged(

-                        new java.security.PrivilegedAction() {

-                            public java.lang.Object run() {

-                                return Thread.currentThread().getContextClassLoader();

-                            }

-                        }

-                );

+            } else {

+                return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {

+                    public ClassLoader run() {

+                        return Thread.currentThread().getContextClassLoader();

+                    }

+                });

             }

         }

 

@@ -277,6 +276,7 @@
                 implements CacheKeyReference {

             private CacheKey cacheKey;

 

+            @SuppressWarnings("unchecked")

             LoaderReference(ClassLoader referent, ReferenceQueue q, CacheKey key) {

                 super(referent, q);

                 cacheKey = key;

@@ -295,6 +295,7 @@
                 implements CacheKeyReference {

             private CacheKey cacheKey;

 

+            @SuppressWarnings("unchecked")

             PersistenceProviderReference(List<PersistenceProvider> referent, ReferenceQueue q, CacheKey key) {

                 super(referent, q);

                 cacheKey = key;