RFR: 8311661: Resolve duplicate symbol of StringTable::StringTable with JDK static linking [v2]

Jorn Vernee jvernee at openjdk.org
Tue Jul 11 16:43:15 UTC 2023


On Mon, 10 Jul 2023 16:40:06 GMT, Jiangli Zhou <jiangli at openjdk.org> wrote:

>> Move StringTable to JavaClassFile namespace.
>
> Jiangli Zhou has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge branch 'master' into JDK-8311661
>  - Move  '} // namespace JavaClassFile' to after '#endif //INCLUDE_CDS_JAVA_HEAP'.
>  - 8311661: Resolve duplicate symbol of StringTable::StringTable with JDK static linking

`using namespace hotspot;` could be used I think:

> using namespace ns-name ; | (5)

> 5) [using-directive](https://en.cppreference.com/w/cpp/language/namespace#Using-directives): From the point of view of unqualified [name lookup](https://en.cppreference.com/w/cpp/language/lookup) of any name after a using-directive and until the end of the scope in which it appears, every name from ns-name is visible as if it were declared in the nearest enclosing namespace which contains both the using-directive and ns-name.

(From: https://en.cppreference.com/w/cpp/language/namespace)

But, if we put everything in the same `hotspot` namespace we shouldn't need to add `hotspot::` qualifiers since things in the same namespace can already refer to each other:


namespace hotspot {
class Bar {
public:
  static int a() { return 0; }
};

int func(Bar* bar) { // Bar is unqualified here
  return bar->a();
}
}

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14808#issuecomment-1631147930


More information about the hotspot-dev mailing list