Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declaring methods and classes uneditable. #12

Open
pumken opened this issue Jan 25, 2023 · 0 comments · May be fixed by #13
Open

Declaring methods and classes uneditable. #12

pumken opened this issue Jan 25, 2023 · 0 comments · May be fixed by #13

Comments

@pumken
Copy link
Contributor

pumken commented Jan 25, 2023

It's difficult to know which classes and methods should be edited or optimized without the textbook and exercises themselves. One way we might accomplish this is by adding

    /**
     * @apiNote Provided by textbook.
     */

to every textbook-provided method/class. This is somewhat inefficient, so we could also add a new annotation. This would not add runtime overhead since using a source retention policy erases them at runtime. It also probably would not be interpreted as a semantically significant token, provided we document its existence clearly in the README.md. This could be accomplished by:

@Documented
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE})
@Retention(RetentionPolicy.SOURCE)
public @interface Textbook {}

Additional meta information can be provided by the following:

@Documented
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE})
@Retention(RetentionPolicy.SOURCE)
public @interface Textbook {
    int page() default -1;
}

This method not only maintains the code's ability to compile, but is also clear and concise. Code using this approach simply looks like:

    @Textbook
    @Override
    public void actionPerformed(ActionEvent e) {
        ...
    }

We would need to add information in the README.md thoroughly explaining how it does not change any program behavior, but only provides meta information at the source level. There is some risk that copying may occur which risks students' assignments, but this proposal makes the reasonable assumption that they read the README. This can be somewhat helped by documentation comments on the annotation.

Is this acceptable as in #13?

@pumken pumken linked a pull request Jan 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant