-1

I am working on a college project java MemoryCatcherServant.java and I am getting this error:

method does not override or implement a method from a supertype

Does anyone have a fix? Any help would certainly be appreciated. Quick and precise answer will certainly be rewarded :)

@Override
public boolean purchaseMemoryPoints(int memoryPointAmount, int userId) {
    String error;
    Connection connection;
    Statement stmt = null;
    Statement stmt2 = null;
    int memoryPoints = 0;

    try {

        connection = DriverManager
        .getConnection("jdbc:mysql://localhost/memorycatcher","root", "root");


    } catch (SQLException e) {
        return false;
    }

    if (connection != null) {


        //make connection
        try {
            stmt = connection.createStatement();
            String sql = "SELECT userMemoryPoints FROM users WHERE userId = \""+userId+"\"";
            ResultSet rs = stmt.executeQuery(sql);

            while(rs.next())
            {

                memoryPoints = rs.getInt("userMemoryPoints");
            }

            rs.close();
            stmt.close();

            int newMemoryPoints = memoryPoints + memoryPointAmount;

            stmt2 = connection.createStatement();
            String sql2 = "UPDATE users SET userMemoryPoints = newMemoryPoints WHERE userId = \""+userId+"\"";

            stmt2.close();
            connection.close();

            return true;
        } catch (SQLException e) {
            //error handling
            return false;
        }

    } else {
        return false;
    }
}

The IDL for the memorycatcher purchase

//user enters the amount of points they want to purchase
boolean purchaseMemoryPoints(in long memoryPointAmount, in long userId);
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

0

Try removing the @Override annotation (first line) for a start.

If you are sure that the method does override another method, though, your compiler might be set to an ancient Java version (the @Override-annotation was not allowed in interfaces before Java 1.6).

Halmackenreuter
  • 681
  • 5
  • 9
  • tried that already. From what I can understand its something to do with the way the method is declared in the .java file and the IDL – Kevin Gleeson Dec 12 '14 at 14:18
  • Removing annotation will "cure" the symptom, not the problem. If compiler did not understand the annotation, there would not be an error at all. @Kevin checkout out the comment to your question by Kayaman, that is, probably your answer – Dima Dec 12 '14 at 14:18