changeset 1803:330b35b27e68

7041251: Use j.u.Objects utility methods in langtools Reviewed-by: jjg
author darcy
date Tue, 26 Mar 2013 17:17:14 -0700
parents 65e1ca8dcdc7
children 33b6a52f0037
files src/share/classes/com/sun/tools/javac/util/Pair.java src/share/classes/javax/annotation/processing/AbstractProcessor.java
diffstat 2 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/util/Pair.java	Mon Mar 25 18:08:47 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/util/Pair.java	Tue Mar 26 17:17:14 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package com.sun.tools.javac.util;
 
+import java.util.Objects;
+
 /** A generic class for pairs.
  *
  *  <p><b>This is NOT part of any supported API.
@@ -46,15 +48,11 @@
         return "Pair[" + fst + "," + snd + "]";
     }
 
-    private static boolean equals(Object x, Object y) {
-        return (x == null && y == null) || (x != null && x.equals(y));
-    }
-
     public boolean equals(Object other) {
         return
             other instanceof Pair<?,?> &&
-            equals(fst, ((Pair<?,?>)other).fst) &&
-            equals(snd, ((Pair<?,?>)other).snd);
+            Objects.equals(fst, ((Pair<?,?>)other).fst) &&
+            Objects.equals(snd, ((Pair<?,?>)other).snd);
     }
 
     public int hashCode() {
--- a/src/share/classes/javax/annotation/processing/AbstractProcessor.java	Mon Mar 25 18:08:47 2013 -0700
+++ b/src/share/classes/javax/annotation/processing/AbstractProcessor.java	Tue Mar 26 17:17:14 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+import java.util.Objects;
 import javax.lang.model.element.*;
 import javax.lang.model.SourceVersion;
 import javax.tools.Diagnostic;
@@ -146,8 +147,7 @@
     public synchronized void init(ProcessingEnvironment processingEnv) {
         if (initialized)
             throw new IllegalStateException("Cannot call init more than once.");
-        if (processingEnv == null)
-            throw new NullPointerException("Tool provided null ProcessingEnvironment");
+        Objects.requireNonNull(processingEnv, "Tool provided null ProcessingEnvironment");
 
         this.processingEnv = processingEnv;
         initialized = true;