you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 insightful - 2 fun3 insightful - 1 fun4 insightful - 2 fun -  (7 children)

Are you satisfied with this answer? https://stackoverflow.com/a/69135668

[–]fschmidt[S] 3 insightful - 2 fun3 insightful - 1 fun4 insightful - 2 fun -  (6 children)

No, the call to canAccess() itself produces a warning.

import java.lang.reflect.*;
import javax.net.SocketFactory;
import javax.net.ssl.SSLSocketFactory;

public class R {
    public static void main(String[] args) throws Exception {
        //System.out.println(sun.security.ssl.SSLSocketFactoryImpl.class); // doesn't work
        SocketFactory sf = SSLSocketFactory.getDefault();
        SSLSocketFactory.class.getMethod("getDefaultCipherSuites").invoke(sf);
        Class cls = sf.getClass();
        System.out.println(cls);
        System.out.println(Modifier.isPublic(cls.getModifiers()));
        Method m = cls.getMethod("getDefaultCipherSuites");
        System.out.println(m);
        System.out.println("isPublic "+Modifier.isPublic(m.getModifiers()));
        System.out.println("canAccess "+m.canAccess(sf));
        m.invoke(sf);  // here is the issue
        System.out.println("done");
    }
}

produces:

class sun.security.ssl.SSLSocketFactoryImpl
true
public java.lang.String[] sun.security.ssl.SSLSocketFactoryImpl.getDefaultCipherSuites()
isPublic true
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by R (file:/Users/fschmidt/tmp/java/) to method sun.security.ssl.SSLSocketFactoryImpl.getDefaultCipherSuites()
WARNING: Please consider reporting this to the maintainers of R
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
canAccess true
done

And canAccess() returns the wrong value.

[–][deleted] 3 insightful - 2 fun3 insightful - 1 fun4 insightful - 2 fun -  (5 children)

Well this is all sounding pretty fucked. Even if there is a clean way to do this in Java 9+ or whatever, it's sad that you have to spend so much effort on it. Maybe the Java is a bit over roasted.

[–]fschmidt[S] 3 insightful - 3 fun3 insightful - 2 fun4 insightful - 3 fun -  (4 children)

I don't really care about Java, or even programming. This is just another example illustrating that modern scum break everything they touch. It is only matter of time before the electrical grid and running water stop working. When will you recognize modern scum for what they are and reject modern culture?

[–][deleted] 2 insightful - 2 fun2 insightful - 1 fun3 insightful - 2 fun -  (3 children)

I hereby reject modern culture. Except for sushi.

[–]fschmidt[S] 2 insightful - 3 fun2 insightful - 2 fun3 insightful - 3 fun -  (1 child)

How dare you insult sushi, a traditional Japanese food? Of course modern culture is trying to destroy sushi with such abominations as the "Philadelphia Roll" and "California Roll". Please help defend sushi from modern culture by only frequenting traditional sushi establishments.

[–][deleted] 2 insightful - 2 fun2 insightful - 1 fun3 insightful - 2 fun -  (0 children)

I formally apologize to Japan. This reformed modern scum will be on the lookout for traditional sushi.

[–]PastorJohnny 1 insightful - 2 fun1 insightful - 1 fun2 insightful - 2 fun -  (0 children)

gay slang for pussy is "fish".. just fyi..