Comments (3)
So, ToolKit.getMenuShortcutKeyMask()
does turn out to be a problem due to Java 8. So the following two methods were deprecated at the same time, in Java 10 (well, I'm assuming it was the same time, anyway):
- InputEvent.getModifiers()
- ToolKit.getMenuShortcutKeyMask()
We use InputEvent.getModifiers()
when processing user input, and our main use of ToolKit.getMenuShortcutKeyMask()
is Mac compatibility. Mac systems should prefer the "command" key instead of Control, and we use that function to get the keycode that we need to check on. (Theoretically, other systems could be configured to have a different menu shortcut key too, of course.)
Their replacements were versions with "Ex" at the end, which report on "extended" modifiers which are a little more sensible to work with. InputEvent.getModifiersEx()
already existed in Java 8, so instances of just using that are easy enough to deal with, but ToolKit.getMenuShortcutKeyMaskEx()
wasn't introduced until Java 10. So if we want to keep Java 8 support, we have to keep on using the deprecated version. The two functions often go hand-in-hand, too, so in cases where we're making use of both methods, we've effectively got to keep on using the deprectated InputEvent.getModifiers()
, too. (We could do some finagling to be able to just use the newer one, but IMO it's not worth the code complication, especially since we don't have an alternative for getMenuShortcutKeyMask()
.
Relatedly, the constant InputEvent.CTRL_MASK
is also deprecated, in favor of InputEvent.CTRL_DOWN_MASK
.
So, for now I've just added in @SuppressWarnings("deprecation")
on a few functions, and we'll just let it sit for longer. Eventually, of course, Java is going to get rid of the old versions, and once that happens, we'll have to choose between continuing to support Java 8, and supporting the newer Java version. I'd be fine with ending Java 8 support in that case... Honestly it might not be a terrible idea to just do it prematurely anyway. The Libera #java community discourages the use of Java 8 nowadays pretty heavily regardless.
The places where I've suppressed deprecation warnings because of this:
blcmm.gui.tree.CheckBoxTree.CheckBoxTree()
- In thekeyPressed
listener that's set up thereblcmm.utilities.Utilities.changeCTRLMasks()
blcmm.gui.panels.EditPanel.setCtrlEnterAction()
So, this bug'll probably have to remain open until we go ahead with ending Java 8 support.
from openblcmm.
Eh, okay, turns out JTextComponent.modelToView(int) and JTextComponent.viewToModel(Point)
is another Java 8 blocker. In those cases, Java 9 added methods with 2D
at the end of the name, which is the versions to call. Those don't exist in Java 8, though, so there's not much to be done if we want to keep on supporting Java 8.
I'm suppressing deprecation warnings for these, too -- fortunately just a single use each. The locations where they're found:
blcmm.gui.text.AutoCompleteAttacher.show()
blcmm.gui.text.HighlightedTextArea.addLink()
- in themouseMoved()
method in the MouseAdapter setup there
from openblcmm.
Okay, at this point we've got no deprecation warnings showing up while compiling. There's the suppressed ones above, which we can't do anything about until we decide to stop supporting Java 8. It looks like they should still be present in Java 21, which I believe is supposed to be the next LTS release, so I think we'd be good for awhile. I'm mentally thinking that maybe we'd drop support for it in OpenBLCMM v1.5.0, whenever that is.
from openblcmm.
Related Issues (20)
- Completely separate OE Application? HOT 1
- Completely separate INI Tweaks app? (And/or Hexedits?)
- Pass around object refs for things like GlobalLogger + Options, rather than relying on static instances HOT 1
- Strip hotfix `name` from mod files entirely
- Don't strip whitespace in `pyb` Python commands HOT 3
- Remember chosen options when disabling/enabling mod
- Attempt to choose the same Mutually Exclusive options when importing mod?
- Double-click to edit multiple lines? HOT 1
- Toggles for each syntax check type in settings? HOT 1
- Overwrite Checker doesn't handle full-attribute overwrites after TPS-style array addition
- Ctrl-Click to open context menu in tree, on Mac? HOT 1
- OE - Fulltext search indexing
- OE - Refs DB Support
- Use JSON/YAML/Something for user prefs HOT 1
- Not detecting bl2 INI files on linux HOT 3
- Mousing over interactables as well as names to show explaination dialogue. HOT 2
- Font size being extremely inconsistent HOT 4
- Native Linux Executable HOT 1
- Add option to automatically make hotfix when warning about using hotfix syntax HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openblcmm.