Repository: assertj/assertj

Problem statement:
import static org.assertj.core.api.Assertions.* clashes with URI (java.net.URI)
#### Summary

Statically importing AssertJ assertions imports fields from `InstanceOfAssertFactories`. The `URI` field shadows `java.net.URI` and requires fully qualified naming when using `java.net.URI`. 

There's a similar issue for `URL` as these two types match exactly constant names from `InstanceOfAssertFactories`.

#### Example

```java
import static org.assertj.core.api.Assertions.*;

URI.create("http://foo")
```

Compilation failure:

```

PagedResourcesAssemblerUnitTests.java:[272,79] cannot find symbol
   symbol:   method create(java.lang.String)
   location: variable URI of type org.assertj.core.api.InstanceOfAssertFactory<java.net.URI,org.assertj.core.api.AbstractUriAssert<?>>
```


Hints:
Thanks for reporting this @mp911de. 

Thinking out loud, we might simply rename the factories to disambiguate this.
That would help. URI and URL are the only two types where factory constants are clashing. All other types use some sort of different letter casing.
Maybe this should have been part of the 3.13.1 release as well @joel-costigliola, as it seems to break existing code and the field names would need to be changed and removed. 
I have a similar impression. Getting this clash out of the way before wide adoption of 3.13.x would be helpful. Once a significant number of projects updates to 3.13 and relies on `InstanceOfAssertFactories.URL/URI`, the rename will break their code. 
> Thanks for reporting this @mp911de.
> 
> Thinking out loud, we might simply rename the factories to disambiguate this.

@joel-costigliola That would be an option, e.g., having ~`URI_INSTANCE`~ `URI_TYPE` instead of `URI`.

Or another option would be to have `Assertions` not implementing `InstanceOfAssertFactories`. That was introduced to simplify the discovery of the factories, but [we realized that for Eclipse was not enough anyway](https://github.com/joel-costigliola/assertj-core/pull/1498#issuecomment-496692889) and IntelliJ seems still able to discover them using the smart completion.
Renaming `URI` to `URI_TYPE` and `URL` to `URL_TYPE` seems the best option. @scordio do you want to tackle this one ?

We will release 3.13.2 at the end of the week just to get a bit more feedback.
@joel-costigliola yes I'll take care of it.

Patch:
diff --git a/src/main/java/org/assertj/core/api/InstanceOfAssertFactories.java b/src/main/java/org/assertj/core/api/InstanceOfAssertFactories.java
--- a/src/main/java/org/assertj/core/api/InstanceOfAssertFactories.java
+++ b/src/main/java/org/assertj/core/api/InstanceOfAssertFactories.java
@@ -204,15 +204,25 @@ static <VALUE> InstanceOfAssertFactory<Optional, OptionalAssert<VALUE>> optional
 
   /**
    * {@link InstanceOfAssertFactory} for a {@link URI}.
+   * <p>
+   * Note: The {@code TYPE} suffix prevents the shadowing of {@code java.net.URI} when the factory is statically imported.
+   * </p>
+   *
+   * @since 3.13.2
    */
-  InstanceOfAssertFactory<URI, AbstractUriAssert<?>> URI = new InstanceOfAssertFactory<>(URI.class,
-                                                                                         Assertions::assertThat);
+  InstanceOfAssertFactory<URI, AbstractUriAssert<?>> URI_TYPE = new InstanceOfAssertFactory<>(URI.class,
+                                                                                              Assertions::assertThat);
 
   /**
    * {@link InstanceOfAssertFactory} for a {@link URL}.
+   * <p>
+   * Note: The {@code TYPE} suffix prevents the shadowing of {@code java.net.URL} when the factory is statically imported.
+   * </p>
+   * 
+   * @since 3.13.2
    */
-  InstanceOfAssertFactory<URL, AbstractUrlAssert<?>> URL = new InstanceOfAssertFactory<>(URL.class,
-                                                                                         Assertions::assertThat);
+  InstanceOfAssertFactory<URL, AbstractUrlAssert<?>> URL_TYPE = new InstanceOfAssertFactory<>(URL.class,
+                                                                                              Assertions::assertThat);
 
   /**
    * {@link InstanceOfAssertFactory} for a {@code boolean} or its corresponding boxed type {@link Boolean}.


Test patch:
diff --git a/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java b/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java
--- a/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java
+++ b/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java
@@ -82,8 +82,8 @@
 import static org.assertj.core.api.InstanceOfAssertFactories.STRING_BUFFER;
 import static org.assertj.core.api.InstanceOfAssertFactories.STRING_BUILDER;
 import static org.assertj.core.api.InstanceOfAssertFactories.THROWABLE;
-import static org.assertj.core.api.InstanceOfAssertFactories.URI;
-import static org.assertj.core.api.InstanceOfAssertFactories.URL;
+import static org.assertj.core.api.InstanceOfAssertFactories.URI_TYPE;
+import static org.assertj.core.api.InstanceOfAssertFactories.URL_TYPE;
 import static org.assertj.core.api.InstanceOfAssertFactories.ZONED_DATE_TIME;
 import static org.assertj.core.api.InstanceOfAssertFactories.array;
 import static org.assertj.core.api.InstanceOfAssertFactories.atomicIntegerFieldUpdater;
@@ -113,6 +113,8 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
 import java.nio.file.Paths;
 import java.time.Instant;
 import java.time.LocalDate;
@@ -319,21 +321,21 @@ void big_integer_factory_should_allow_big_integer_assertions() {
   }
 
   @Test
-  void uri_factory_should_allow_uri_assertions() {
+  void uri_type_factory_should_allow_uri_assertions() {
     // GIVEN
-    Object value = java.net.URI.create("http://localhost");
+    Object value = URI.create("http://localhost");
     // WHEN
-    AbstractUriAssert<?> result = assertThat(value).asInstanceOf(URI);
+    AbstractUriAssert<?> result = assertThat(value).asInstanceOf(URI_TYPE);
     // THEN
     result.hasHost("localhost");
   }
 
   @Test
-  void url_factory_should_allow_url_assertions() throws MalformedURLException {
+  void url_type_factory_should_allow_url_assertions() throws MalformedURLException {
     // GIVEN
-    Object value = new java.net.URL("http://localhost");
+    Object value = new URL("http://localhost");
     // WHEN
-    AbstractUrlAssert<?> result = assertThat(value).asInstanceOf(URL);
+    AbstractUrlAssert<?> result = assertThat(value).asInstanceOf(URL_TYPE);
     // THEN
     result.hasHost("localhost");
   }