• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Fixing deprecated Elements of Open Source SIMULA Project  RSS feed

Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I downloaded the source code for the SIMULA project from "sourceforge.net" and noticed that when I compile the 35 Java files it consists of, all the files compile, but I get the message "Note: Some input files use or override a deprecated API. / Note: Recompile with -Xlint:deprecation for details. / Note: Some input files use unchecked or unsafe operations. / Note: Recompile with -Xlint:unchecked for details." I decided a nice project for me would be to modify the code so that it doesn't generate these warning messages. To start, I decided to take care of the deprecated code problems, so I went to "simags-src-2B\src" and executed "javac -d ..\target -deprecation SIMULA.java". That gave me a whole bunch of warning messages, but it ended with: ".\PaintDialog.java:45: warning: [deprecation] handleEvent(Event) in Component has been deprecated / public boolean handleEvent(Event evt) {". It looks like the problem is that class {PaintDialog} extends class {Dialog} that extends class {Window} that extends class {Container} that extends class {Component}, and {Component} has a method {handleEvent()} that {PaintDialog} overrides, that is deprecated. The deprecation information for this method at "https://docs.oracle.com/javase/7/docs/api" says: "Deprecated. As of JDK version 1.1 replaced by processEvent(AWTEvent)".

So my guess is that where "PaintDialog.java" overrides method {handleEvent()}, I need to take that out and override method {processEvent()} instead. But the code for overriding {handleEvent()} is like follows:

Class {Event} clearly has an {x} member variable, a {y} member variable, and a {metaDown()} member method, while class {AWTEvent} doesn't have any of those members. Is there some way to generate the equivalent of the {x} and {y} variables for an {AWTEvent} object, so that I can write a {processEvent()} method that does the equivalent thing? And similarly for {metaDown()}? I noticed that {AWTEvent} does have an {id} member variable; can I assume that I can do the same thing with it in {processEvent()} that the existing {handleEvent()} does with {evt.id}? If I can't do any of these things, then what can I do to fix the code so that it makes the SIMULA project run right without using deprecated methods?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!