Skip to content

Commit

Permalink
Identify illegal reflective access
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-beetz committed May 15, 2018
1 parent 1c8d38a commit bcfde56
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/GUIGlobals.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static void init() {
// Set WM_CLASS using reflection for certain Un*x window managers
if (!OS.WINDOWS && !OS.OS_X) {
try {
// TODO: reflective access, should be removed (Java 9)
Toolkit xToolkit = Toolkit.getDefaultToolkit();
java.lang.reflect.Field awtAppClassNameField = xToolkit.getClass().getDeclaredField("awtAppClassName");
awtAppClassNameField.setAccessible(true);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/groups/GroupTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ public void addNewGroup(ActionEvent actionEvent) {
*/
private void setupClearButtonField(CustomTextField customTextField) {
try {
// TODO: reflective access, should be removed (Java 9)
Method m = TextFields.class.getDeclaredMethod("setupClearButtonField", TextField.class,
ObjectProperty.class);
m.setAccessible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private Boolean initColumnSize(TableView<?> table) {
private void resize(TableColumnBase column, double delta) {
// We have to use reflection since TableUtil is not visible to us
try {
// TODO: reflective access, should be removed (Java 9)
Class<?> clazz = Class.forName("javafx.scene.control.TableUtil");
Method constrainedResize = clazz.getDeclaredMethod("resize", TableColumnBase.class, double.class);
constrainedResize.setAccessible(true);
Expand All @@ -74,6 +75,7 @@ private Boolean constrainedResize(TableView.ResizeFeatures<?> prop) {
private Boolean constrainedResize(TableView.ResizeFeatures prop, Boolean isFirstRun, Double contentWidth, List<? extends TableColumnBase<?, ?>> visibleLeafColumns) {
// We have to use reflection since TableUtil is not visible to us
try {
// TODO: reflective access, should be removed (Java 9)
Class<?> clazz = Class.forName("javafx.scene.control.TableUtil");
Method constrainedResize = clazz.getDeclaredMethod("constrainedResize", ResizeFeaturesBase.class, Boolean.TYPE, Double.TYPE, List.class);
constrainedResize.setAccessible(true);
Expand All @@ -87,6 +89,7 @@ private Boolean constrainedResize(TableView.ResizeFeatures prop, Boolean isFirst

private Double getContentWidth(TableView<?> table) {
try {
// TODO: reflective access, should be removed (Java 9)
Field privateStringField = TableView.class.getDeclaredField("contentWidth");
privateStringField.setAccessible(true);
return (Double) privateStringField.get(table);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ public void setAutoCompleter(AutoCompleteSuggestionProvider<Author> searchComple
@SuppressWarnings("unchecked")
private <T> AutoCompletePopup<T> getPopup(AutoCompletionBinding<T> autoCompletionBinding) {
try {
// TODO: reflective access, should be removed (Java 9)
Field privatePopup = AutoCompletionBinding.class.getDeclaredField("autoCompletionPopup");
privatePopup.setAccessible(true);
return (AutoCompletePopup<T>) privatePopup.get(autoCompletionBinding);
Expand Down

0 comments on commit bcfde56

Please sign in to comment.