Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5840929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:49:14+00:00 2026-05-22T11:49:14+00:00

this is my first posted question. I have a fairly complicated OQL query which

  • 0

this is my first posted question. I have a fairly complicated OQL query which lists static fields of classes loaded in our packages. One problem I’m seeing with running the query against ‘jhat’ of Java 1.6.0_24 is that the ‘unique’ function doesn’t work as expected. I expect

select unique(['a', 'b', 'c', 'a'])

to return [‘a’, ‘b’, ‘c’] but instead it returns [‘a’], wtf?

If anyone’s interested the actual full query is (replace ‘com.mydomain’ with what you like):

select cl.name + ' -- ' + unique(map(filter(referees(cl), "classof(it).name != 'java.lang.Class' && classof(it).name != 'java.lang.String' && classof(it).name != 'sun.misc.Launcher$AppClassLoader' && classof(it).name != 'java.security.ProtectionDomain' && classof(it).name != '[Ljava.security.cert.Certificate;' && classof(it).name != 'sun.plugin2.applet.JNLP2ClassLoader'"), "classof(it).name")).join(', ')
from instanceof java.lang.Class cl
where /com.mydomain./(cl.name) && ! /com.mydomain.xs.protobuf./(cl.name)
&& length(filter(referees(cl), "classof(it).name != 'java.lang.Class' && classof(it).name != 'java.lang.String' && classof(it).name != 'sun.misc.Launcher$AppClassLoader' && classof(it).name != 'java.security.ProtectionDomain'")) > 0;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:49:15+00:00Added an answer on May 22, 2026 at 11:49 am

    By default, unique uniquifies on the object’s objectid, which is suitable for actual traced objects, but for strings it returns null. Thus, only the last string is kept (since all the strings have non-unique objectid values).

    You have two options:

    1. Uniquify on the traced objects, rather than their names:

      map(unique(filter(map(referees(cl), classof), "it.name != ...")), "it.name")
      
    2. Specify the “function” to uniquify with, so that it works for strings:

      unique(['a', 'b', 'c', 'a'], 'it')
      

      This will cause the strings themselves to be uniquified.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off I apologize... I have posted this question before, but I did a
I have posted this question at MathOverflow.com as well. I am no mathematician and
This is probably the worst question I have ever posted on Stack Overflow but
I posted a question about this earlier, but I have more information now and
I posted this question a while back which was answered well: Complex regex to
this is my first question posted on the internet ever, I was usually able
(Note - this is a re-post as my first question got posted under wrong
I have posted another question for the same project which was helpfully answered but
I have posted a question on here previously asking similar advise, but this project
When I first posted this question I had strong coupling between my web service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.