• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Fixing deprecated Elements of Open Source SIMULA Project

 
Ranch Hand
Posts: 238
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic