pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/jruby/jruby/commit/2465a9375fba92e983e31e50a97285a37374bfca

/> Skip invasive test and add one that works on Java 9+ · jruby/jruby@2465a93 · GitHub
Skip to content

Commit 2465a93

Browse files
committed
Skip invasive test and add one that works on Java 9+
The skipped test will fail on Java 9+ because we are calling from a named module into a java.base package that's not open. In order to keep the basic spirit of the test running, I added a similar test against the JI fixtures we load via classpath. These APIs (JavaClass etc) are deprecaed, but we do not yet have a clean path to replacing and removing them. Therefore we should at least keep basic tests working.
1 parent 63643ce commit 2465a93

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

spec/java_integration/fixtures/JavaFields.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public class JavaFields {
5252
public Boolean trueObjField = Boolean.TRUE;
5353
public Boolean falseObjField = Boolean.FALSE;
5454

55+
private final int privateIntField = 1;
56+
5557
Object field1 = this;
5658
Object[] aryField2 = new Object[] { this };
5759

test/jruby/test_higher_javasupport.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,27 @@ def test_direct_package_access
917917
assert_equal(0, a.size)
918918
end
919919

920+
def test_open_reflected_field
921+
java_fields = Java::JavaClass.for_name('java_integration.fixtures.JavaFields')
922+
begin
923+
java_fields.field('privateIntField')
924+
fail('value field is not public!')
925+
rescue NameError => e
926+
assert e
927+
end
928+
value_field = java_fields.declared_field('privateIntField')
929+
assert_equal false, value_field.static?
930+
assert_equal false, value_field.public?
931+
assert_equal true, value_field.final?
932+
assert_equal false, value_field.accessible?
933+
value_field.accessible = true
934+
assert_equal 1, value_field.value( java_fields.constructor.new_instance )
935+
assert_equal 'int', value_field.value_type
936+
end
937+
920938
def test_reflected_field
939+
skip if JAVA_9
940+
921941
j_integer = Java::JavaClass.for_name('java.lang.Integer')
922942
begin
923943
j_integer.field('value')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy