Eclipse Warnings/Errors Suppression

Discussion in 'Spigot Plugin Development' started by WAS, May 6, 2017.

  1. WAS

    WAS

    Is there any way to disable warning/errors on certain files or something? Sure annoying working with a project with multiple jar dependencies and switching between them to check for compatibility while the IDE log is filled with other errors to be expect from other version classes.
     
  2. I'm sorry, but aren't errors supposed to be... not errors? If you compile your code with errors it'll lead to problems.
    Certain warnings can be suppressed with the @ SuppressWarnings annotation.
     
  3. WAS

    WAS

    Please understand when you are working on a cross-version compatible plugin your classes which are not compatible with a version you are working on will show errors / deprecation.

    However this interferes with the actual errors you need to fix for you classes for the present version you are working on with more errors in the IDE log than needed.
     
  4. If you really want to disable warnings (even though, of course, they are there for a reason), you could place a @SuppressWarnings annotation above the line where your class is defined. This will disable all warings generated for that class.

    Something like this :
    Code (Text):
    package com.spigotmc.package.name;

    @SuppressWarnings(value = { "all" })
    public class Main {

    }
     
     
  5. For cross-version plugins you should use some other project layout than throwing everything together in one project. Have a single project for each single minecraft version.
     
  6. It's quite simple, just add all supported spigot versions to your classpath - or use reflection :)