Jawa / Говнокод #19310 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
package java.util;

/**
 * This class consists of {@code static} utility methods for operating
 * on objects.  These utilities include {@code null}-safe or {@code
 * null}-tolerant methods for computing the hash code of an object,
 * returning a string for an object, and comparing two objects.
 *
 * @since 1.7
 */
public final class Objects {
    private Objects() {
        throw new AssertionError("No java.util.Objects instances for you!");
    }
}

Because Fuck You

Запостил: stokito stokito, (Updated )

Комментарии (3) RSS

  • Надо же, а так хотелось...
    (интересно, а можно ли как-нибудь вызвать приватный конструктор - скажем, через рефлексию)
    Ответить
    • Можно. Через setAccessible.

      public static void main(final String[] args) throws ReflectiveOperationException, SecurityException {
      	final Constructor<Objects> ctor = Objects.class.getDeclaredConstructor();
      	ctor.setAccessible(true);
      	ctor.newInstance();
      }


      Exception in thread "main" java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      	at ObjectsTest.main(ObjectsTest.java:8)
      Caused by: java.lang.AssertionError: No java.util.Objects instances for you!
      	at java.util.Objects.<init>(Objects.java:40)
      	... 5 more
      Ответить

Добавить комментарий

Переведи на "PHP", guest!

    А не использовать ли нам bbcode?


    8