Java – How to commit classes and interfaces in two different functional branches (git flow eclipse)

How to commit classes and interfaces in two different functional branches (git flow eclipse)… here is a solution to the problem.

How to commit classes and interfaces in two different functional branches (git flow eclipse)

I use Eclipse with the Git Flow extension. I tried committing interfaces and classes in two different functional branches. After committing the interface for the first time in the first functional branch, I want to do the same with the class. But the class has an error because some part of the code is not recognized (e.g. variables, methods, etc.) because this part of the code is in another branch. What can I do?

Solution

You cannot separate an interface from a concrete class.
You can do two things:

  1. Commit the interface on your development branch and the concrete class after opening the feature branch
  2. You create interfaces and classes in two different functional branches, but in concrete classes you must annotate the implementation command ex:

    class Concrete /* implements myInterface */ {
    

In the second case, you have two correct functional branches, and after merging you must remove the comment tags by specific class.

Related Problems and Solutions