-
Notifications
You must be signed in to change notification settings - Fork 1
Description
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?